【发布时间】:2018-07-23 20:02:32
【问题描述】:
我已经读到,进行字符串比较不是确定 hmac 签名是否匹配的首选方法。 (Go to Step 5) 所以,在 Node 中,给定这样的东西
const hmac = crypto.createHmac("sha256", signingSecret).update(buf, encoding);
const computed = `${version}=${hmac.digest('hex')}`;
if(computed !== req.header("signature")){
throw
}
如果不用于字符串比较,那么执行此行的首选方式是:computed !== req.header("signature")?
【问题讨论】:
标签: node.js cryptography hmac