+44 (791) 5698 086

hmac_sha512 to jsSHA

A quick conversion of hmac_sha512 of php to a javascript library based jsSHA.

e.g. if we had the php code:

<?php 
 $sign = hash_hmac('sha512', $post_data, $secret);
 
 echo $sign;

This can be converted to the jsSHA based javascript code like this:

 var shaObj = new jsSHA("SHA-512", "TEXT");
 shaObj.setHMACKey(secret, "TEXT");
 shaObj.update(post_data);
 var hmac = shaObj.getHMAC("HEX");

I hope this helps.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Who are we?

Nabtron team includes web, desktop software and mobile apps developers along with SEO professionals.

We are available 24 hours, 7 days a week. Contact us now for anything you need!

Join our mailing list

Lets become friend :) What's your name & email?