#!perl use strict; use Digest::SHA qw( hmac_sha256_base64 ); use MIME::Base64; my $datestring = '08 Apr 2015 21:37:33 GMT'; my $method = 'GET'; my $appid = 'd6468df6c1e8419fb5ec50f62be9a28b'; my $appkey = '15c7a6e1a5bd73500db29dffd0e19b6c6228b044c64348a6f5d6d470c54fc208'; my $path = '/xxxxxxxxxxxx/xxxxxxx/api/v1/users/xxxxx/factors'; # build the hash string my $step1 = "$method\\n$datestring\\n$appid\\n$path"; print "$step1\n"; # hmac, base64 and add padding my $step3 = hmac_sha256_base64($step1, pack "H*",$appkey); while (length($step3) % 4) { $step3 .= '='; } my $step4 = 'ApplicationID:'.$step3; print "$step4\n"; my $step6 = "Basic :".encode_base64($step4,''); print "$step6\n";