jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Need helping creating a md5 hash
Date Sat, 20 Nov 2010 12:23:38 GMT
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 <shettyd@gmail.com> 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 <jlukensow@gmail.com> 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: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message