The code below is meant to be put in a beanshell (pre/post/listener/sampler)


On Sat, Nov 20, 2010 at 4:23 AM, Deepak Shetty <[email protected]> wrote:

> Hi
> import java.security.MessageDigest;
>
>         String text = vars.get("text"); //assuming this is where your
> variable is
>
>         MessageDigest md = MessageDigest.getInstance("MD5");
>         byte[] md5hash = new byte[32];
>         md.update(text.getBytes("utf-8"), 0, text.length());
>         md5hash = md.digest();
>
> Should give you an MD5 hash. but how you convert your byte[] into something
> else (like a hex string ) is dependent on how the receiving party expects it
>
> regards
> deepak
>
>
>
> On Fri, Nov 19, 2010 at 5:14 PM, 5942marine <[email protected]> wrote:
>
>>
>> First time poster here.
>>
>> So my question is, how can I create a md5 hash of a variable that I get
>> through a json response. I have the variable via regex saved to a
>> parameter,
>> but I need to md5 hash it, so my next call will suceed.
>>
>> I've been looking into loading a .jar or including some java in the
>> beanshell, but I'm at a complete loss.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks,
>> --
>> View this message in context:
>> http://jmeter.512774.n5.nabble.com/Need-helping-creating-a-md5-hash-tp3273251p3273251.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