Re: hmac digest wrong?
Of course! - thank you On 21 Apr 2009, at 17:42, Victor Duchovni wrote: On Tue, Apr 21, 2009 at 04:36:34PM +0100, 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? Yes. The "echo" built-in appends a newline to the output. -- Viktor. __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
Re: hmac digest wrong?
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 9036ku...@tenebras.com Berkeley CA 94709 http://xijiaoshan.blogspot.com __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
Re: hmac digest wrong?
On Tue, Apr 21, 2009 at 04:36:34PM +0100, 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? Yes. The "echo" built-in appends a newline to the output. -- Viktor. __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
hmac digest wrong?
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? BTW I'm using OpenSSL 0.9.7l on OS X 10.5.6 Thanks, Ronald __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org