# echo -n 'value' | openssl dgst -sha1 -hmac 'key'
57443a4c052350a44638835d64fd66822f813319
# rpm -qa | grep openssl
openssl-0.9.8e-22.el5_8.3
# cat /etc/redhat-release
CentOS release 5.8 (Final)
Note that I show the version and operating system I'm using. Here's why. Look at the following:
# echo -n 'value' | openssl dgst -sha1 -hmac 'key'
(stdin)= 57443a4c052350a44638835d64fd66822f813319
# rpm -qa | grep openssl
openssl-1.0.0-20.el6_2.5.x86_64
# cat /etc/redhat-release
CentOS release 6.2 (Final)
So on a more recent system, openssl has prefixed it's output with "(stndin)= ".
I'm not finding this particularly helpful for my application.
One workaround, suggested here, is to use sed to remove it, like this:
# echo -n 'value' | openssl dgst -sha1 -hmac 'key' | sed 's/^.*= //'
57443a4c052350a44638835d64fd66822f813319
No comments:
Post a Comment