1)crypto模块
crypto.createHmac('sha1', app_secret).update('待加密字串').digest().toString('base64'); //base64
crypto.createHmac('sha1', app_secret).update('待加密字串').digest('hex'); //16进制
2)crypto-js
var CryptoJS = require('crypto-js');
var str = 'orderId=21140600050549799429&携激御orderStatus=TRADE_SUCCESS&payTime=2014-07-22 11:43:31';
var key = 'REzySUKRCPfyfV/jfgwTA==';
var sign = CryptoJS.HmacSHA1(str, key).toString();
console.log(sign);