var crypto = require('crypto');
var output = encrypt(key,str);
function encrypt(key, str){
var hmac = crypto.createHmac("sha512", key);
var signed = hmac.update(new Buffer(str, 'utf-8')).digest("base64");
return signed
}
这里我没有得到正确的输出作为
中的相同输出Java.byte[] decodedKey = Hex.decodeHesecretKey.toCharArray());
SecretKeySpec keySpec = new SecretKeySpec(decodedKey, algorithm);
Mac mac = Mac.getInstance(algorithm);
mac.init(keySpec);