var stringToSign = “string to sign”;var secret = “my secret key”;var signature =CryptoJS.HmacSHA1(stringToSign, secret);
NodeJS
This code assumes you have the crypto-js library installed (npm install crypto-js)
$ cat hmacsha1.js var CryptoJS =require('crypto-js'), message ="string to sign", secret ="my secret key", sig =CryptoJS.HmacSHA1(message, secret);console.log(""+ sig);$ node hmacsha1.js a993876ea1218921a1c8551923473da7b310dfae
Objective-C
HMAC-SHA1 functionality can be be included in IOS code by first adding the CommonCrypto library to your target, and including the following function in your appDelegate (or appropriate class)