agnome has asked for the wisdom of the Perl Monks concerning the following question:
I'm having problems with hash encoding in Perl. I've narrowed it down to the following code which seems to be giving me the wrong result
#!/usr/bin/perl use warnings; use strict; use Digest::SHA qw(sha256 sha256_hex); my $digest=sha256_hex("138539083512345apiKeyDEMO","apiSecretDEMO" ); print "Digest=$digest\n"; # correct answer is: #696E087F4B1902AA58D35E75B4600580D70A92ED68B23379373117FB3FE3064A # my code generates: #ea645ae07e04289f3fe14c81af54f7da9cae1114fe2bb9efbb6b383ef276434b
I've included what the answer should be at the bottom. I've checked the answer at http://hash.online-convert.com/sha256-generator and it confirms the correct figure. Why is my code generating the wrong answer?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with HMAC SHA-256
by marto (Cardinal) on Mar 07, 2014 at 16:25 UTC | |
by agnome (Initiate) on Mar 07, 2014 at 18:47 UTC | |
|
Re: Problems with HMAC SHA-256
by hazylife (Monk) on Mar 07, 2014 at 16:26 UTC | |
|
Re: Problems with HMAC SHA-256
by hippo (Archbishop) on Mar 07, 2014 at 16:31 UTC | |
|
Re: Problems with HMAC SHA-256
by 2teez (Vicar) on Mar 07, 2014 at 16:28 UTC |