HMAC_MD5 encryption algorithms (Javascript & Perl)

Hey PG folks.  I've attached two samples of code for creating the HMAC_MD5 pg_ts_hash in languages that you didn't already have listed in your documentation and developer's forum.  You are welcome to publish these examples.







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;




For Javascript:


<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");




[Contributor's notes]   I would not recommend the Javascript example as the Secret Key would be viewable by anyone who viewed the source of the HTML document, but it certainly works and for something like an intranet, or internal use only, it would be fine.

Disclaimer: These examples have been provided by users and have not been thoroughly tested under all conditions. ACH Direct and Payments Gateway, therefore, cannot guarantee or imply reliability, serviceability, or function of this code.

All code contained herein are provided to you "AS IS" without any warranties of any kind

Follow Us

Stay up to date with the latest PG news via RSS, Twitter and Google +1

Copyright © 2012 Payments Gateway - All Rights Reserved Privacy | Legal