jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 5942marine <jluken...@gmail.com>
Subject Re: Need helping creating a md5 hash
Date Sun, 21 Nov 2010 07:00:10 GMT

Deepak, I got it!

Before, I was using a Beanshell Pre Processor as a child of the Sampler.

But I tried using a Beanshell Sampler, right after the request sampler, and
now it's working, creating a md5 hash. 

Is that okay, the way i'm doing it, the only thing I notice is that in the
View Results in Tree, I see the Bean Shell Sampler.

But thank you, thank you!

Here's what I'm using, for a reference to anyone else.

import java.security.MessageDigest;
import java.math.BigInteger;
String plaintext = vars.get("time") + "1js3kl23"; // Need to add a key to
the time that gets hashed
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(plaintext.getBytes());
byte[] digest = m.digest();
BigInteger bigInt = new BigInteger(1,digest);
String hashtext = bigInt.toString(16);
// Now we need to zero pad it if you actually want the full 32 chars.
while(hashtext.length() < 32 ){
  hashtext = "0"+hashtext;
}
vars.put("timehash",hashtext);
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Need-helping-creating-a-md5-hash-tp3273251p3274114.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message