customize output of command "openssl dgst -hmac"
Matthew Martinez
I want to compute the HMAC of file A.txt and put it into file A_hmac.txt. I use openss library, now I have:
openssl dgst -hmac "myHmacKey" -out A_hmac.txt A.txtThe output, inside A_hmac.txt, is:
HMAC-SHA256(A.txt)= 5aaee07459e341752...How do I manage to have as output only:
5aaee07459e341752...Thanks
01 Answer
Though, Not an OpenSSL solution, In Linux;
openssl dgst -hmac "myHmacKey" output.txt
outputs
HMAC-SHA256(output.txt)= 3bcf4e453c9b8008035e7f5e0ea84f092f795fc602bb3adccfde0f916dd565b2The using the cut on the space char
openssl dgst -hmac "myHmacKey" output.txt | rev | cut -d' ' -f1 | rev > myHmacKeyThen cat myHmacKey outputs
3bcf4e453c9b8008035e7f5e0ea84f092f795fc602bb3adccfde0f916dd565b2