2
我需要在Python重現什麼perl做蟒蛇相同功能的perl的hmac_sha1_hex
# perl
perl -e'use Digest::HMAC_SHA1 qw(hmac_sha1_hex); my $hmac = hmac_sha1_hex("string1", "string2"); print $hmac . "\n";'
25afd2da17e81972b535d15ebae464e291fb3635
#python
python -c 'import sha; import hmac; print hmac.new("string1", "string2", sha).hexdigest()'
3953fa89b3809b8963b514999b2d27a7cdaacc77
正如你所看到的十六進制摘要是不一樣的...我怎樣才能重現蟒蛇Perl代碼?
謝謝!
'perl的-MDigest :: HMAC_SHA1 = hmac_sha1_hex -E '說hmac_sha1_hex( 「STRING1」, 「字符串2」)'' 看起來好得多在Perl世界 – yko