2

perl が行っていることを python で再現する必要がある

  # 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

ご覧のとおり、16進ダイジェストは同じではありません...どうすればPythonでperlコードを再現できますか?

ありがとう !

4

1 に答える 1