0

I'm working with HMAC codes. I use two different methods and I obtain two different results :(

Use command line:

echo "text" > auxFile
openssl dgst -hmac key auxFile

Output:

HMAC-SHA256(auxFile)= ca283981e31711509c5c9ddff2b47c7cf45e64e6cdd5738557666160cd9282a6

Use online HMAC calculator https://www.freeformatter.com/hmac-generator.html#ad-output

Insert text: text Insert HMAC key: key

Output:

6afa9046a9579cad143a384c1b564b9a250d27d6f6a63f9f20bf3a7594c9e2c6

Why output are different? should I convert the string "key" to some format? openssl documentation doesn't help https://www.openssl.org/docs/man1.0.2/man1/openssl-dgst.html

1 Answers1

0

Echo command adds terminal char at the end of file. Use -n option.

echo -n "text" > auxFile
openssl dgst -hmac key auxFile