I'm trying to compute hmac using sha-512.
The Perl code:
use Digest::SHA qw(hmac_sha512_hex);
$key = "\x0b"x20;
$data = "Hi There";
$hash = hmac_sha512_hex($data, $key);
print "$hash\n";
and gives the correct hash of
87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cde
daa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854
Python version:
import hashlib, hmac
print hmac.new("\x0b"*20, "Hi There", hashlib.sha512).hexdigest()
which gives the incorrect hash of
9656975ee5de55e75f2976ecce9a04501060b9dc22a6eda2eaef638966280182
477fe09f080b2bf564649cad42af8607a2bd8d02979df3a980f15e2326a0a22a
any ideas why the Python version is giving me the wrong hash?
Edit:
version is
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin