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: [email protected]
For additional commands, e-mail: [email protected]