jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Need helping creating a md5 hash
Date Sat, 20 Nov 2010 15:59:10 GMT
On 20 November 2010 14:48, 5942marine <jlukensow@gmail.com> wrote:
>
> Thanks Deepak for the quick reply.
>
> This is what I put into my Beanshell Pre- Processor
>
> import java.security.MessageDigest;
> String text = vars.get("time")

Missing ; on previous line.

> MessageDigest md = MessageDigest.getInstance("MD5");
> byte[] md5hash = new byte[32];
> md.update(text.getBytes("utf-8"), 0, text.length());
> md5hash = md.digest();
> vars.put("stimehash",md5hash);
>
> Now, I have just a few questions. The paramater time is what I'm trying to
> hash. I believe I have the correct. But in the beanshell on the top, theirs
> a field:
>
> Parameters to be passed to beanshell...

That is mainly in case you want to use a file.

> I assume I need to put in the parameter from my previous regex correct,
> which is "time"

Not needed.

> Secondly, after running, I got the followin in my jmeter.log
>
> 2010/11/20 07:38:25 ERROR - jmeter.util.BeanShellInterpreter: Error invoking
> bsh method: eval        In file: inline evaluation of: ``import
> java.security.MessageDigest; String text = vars.get("time") MessageDiges . .
> . '' Encountered "MessageDigest" at line 3, column 1.

See above.

> And lastly, the last line of the beanshell, I have the vars.put..., Which I
> assume is the correct way to create a new paramater that I can reference,
> since I need to keep the original value of the paramater time.

Yes.

Or you could use a BeanShell function and return the value directly.

> Again, thanks for all your help!
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/Need-helping-creating-a-md5-hash-tp3273251p3273660.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
>
>

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