Hi
you can use the Beanshell as Pre Processor of the next sampler(so it will
execute before you need it) or you can attach it as a listener to the
sampler on which your regex post processor is extracting out the value (so
it will execute after the post processor)- You can also attach it as a post
processor (so long as it comes after the regex post processor ) but I dont
like relying on order of post processor ...

regards
deepak

On Sat, Nov 20, 2010 at 11:00 PM, 5942marine <[email protected]> wrote:

>
> 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]
>
>

Reply via email to