awohld has asked for the wisdom of the Perl Monks concerning the following question:
Here is the Python code that calcs the SHA1 properly#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Modern::Perl; use Digest::SHA qw( sha1 sha1_hex sha1_base64 hmac_sha1 hmac_sha1_hex + hmac_sha1_base64 ); my $var = 'A10000009296F2'; say "hmac_sha1: " . hmac_sha1($var); say "hmac_sha1_hex: " . hmac_sha1_hex($var); say "hmac_sha1_bae_64: " . hmac_sha1_base64($var); say "sha1: " . sha1($var); say "sha1_hex: " . sha1_hex($var); say "sha1_base64: " . sha1_base64($var); say "orig var: " . $var;
import hashlib mid = 'A10000009296F2'.upper() s = hashlib.sha1(mid.decode('hex')) print s.hexdigest()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SHA1 Not Generating Properly
by daxim (Curate) on Jul 05, 2012 at 07:14 UTC | |
|
Re: SHA1 Not Generating Properly ( hex string is not hex encoded number )
by Anonymous Monk on Jul 05, 2012 at 07:08 UTC | |
|
Re: SHA1 Not Generating Properly
by awohld (Hermit) on Jul 05, 2012 at 13:27 UTC |