Ronald Hatcher wrote:
> Hi there -
>
> I'm trying to create an hmac digest which works OK from php as:
>
> $signature = hash_hmac('sha1', "ronald" , $apikey);
>
> However, I get a different digest using:
>
> echo "ronald" | openssl dgst -sha1 -hmac $apikey
>
> Is there something obvious I'm doing wrong here?
Luckily, yes. The latter version has an extra char.
man echo.
try `echo -n "ronald" | openssl dgst -sha1 -hmac $apikey`
which doesn't add the '\n' that your version does.
--
Michael Sierchio +1 415 378 1182
PO Box 9036 [email protected]
Berkeley CA 94709 http://xijiaoshan.blogspot.com
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]