use strict; use Digest::HMAC_SHA1; my $key="This is the secret key"; my $input="Good Evening"; my $hmac=new Digest::HMAC_SHA1($key); $hmac->add($input); my $digest=$hmac->b64digest(); print "key:$key, input:$input, digest:$digest\n"; #output: key:This is the secret key, input:Good Evening, digest:kRfi1C7Q64oHS+6hEX2BnYB/tnc