JMeter how to create sha512sum?

31 Views Asked by At

I'm new to scripting. I have the following use case: I need to check whether a message is sent with or without an attachment. I encountered a problem generating sha512. With which JMeter option is it possible to generate this and use it to send messages? I would be very grateful for your advice

In one of the sources I found that you can use JSR223 Sampler, in another PreProcessor JSR223. Both didn't work, maybe there was a Problem in the code I was trying to write.

1

There are 1 best solutions below

0
Dmitri T On

Your "didn't work" stanza doesn't tell the full story, going forward consider providing sufficient amount of information so we could better understand your problem or reproduce your issue.

Coming back to your question, the easiest is going for __digest() function, something like:

${__digest(SHA-512,string-you-want-to-encode-here,,,)}

enter image description here

For JSR223 test elements you can do the same using MessageDigest class instance, something like:

java.security.MessageDigest.getInstance('SHA-512').digest('foo'.getBytes()).encodeHex().toString()

enter image description here

More information on cryptographic operations in particular and Groovy scripting in JMeter in general: