Creating HMAC-MD5 Algorithms

The following topic provides examples for creating HMAC-MD5 encryption algorithms in JavaScript and Perl for Forte's SOAP web services and Secure Web Pay application, specifically the pg_ts_hash (SWP) and TSHash (SOAP web services) parameters. NOTE: The JavaScript code should only be used internally or on a secure intranet as the Secret Key is viewable to anyone who views the HTML source code.

Perl Sample Code


use Digest::HMAC_MD5 qw(hmac_md5_hex);

# generate hex hash of message with secret key
my $digest = hmac_md5_hex("MESSAGE_TEXT","SECRET_KEY");

print $digest;
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
     // Generate hex hash of message with secret key
     var hmac = Crypto.HMAC(Crypto.MD5, "MESSAGE", "SECRET_KEY");