sha256签名加密后输出base64编码:JS:
const crypto = require('crypto');
var sign = crypto.createHmac('sha256',secretKey).update('1234567890').digest('base64');
return sign //输出gillOqwrSirL5cH4kiL7px1hSJ5tog/NfiY5J8T/Xq0=
python:
import hmac
mac = hmac.new(bytes(secretKey, encoding='utf8'), bytes('1234567890', encoding='utf-8'), digestmod='sha256')
d = mac.digest()
return base64.b64encode(d)//输出9c1+B5qU/NXET8TuNIR0Yh92mIowEy20W44p7IHNpE=
同样是sha256加密,两个程序用来签名的secretKey相同的,为什么输出的加密结果不同?
添加回答
举报
0/150
提交
取消