I'm trying to port a PHP example of an API integration to Javascript / JQuery. In PHP, an encrypted string is created using the following code:
$sig = base64_encode(hash_hmac('sha256', $sign, $this->secretAccessKey, true)
whose functions are documented here:
http://php.net/manual/en/function.hash-hmac.php
http://us.php.net/base64_encode
In Javascript, I'm using JQuery's crypto to do the HMAC piece:
http://code.google.com/p/crypto-js/#HMAC-SHA256
and I'm trying to figure out if I also need to do a base64 encode, as it seems it is already in base64. This is the code I'm currently running:
var sigHash = Crypto.HMAC(Crypto.SHA256, sign, accessKey);
Is this correct? How would I create a javascript / jquery equivalent of the above PHP function?