【发布时间】:2018-12-05 01:40:06
【问题描述】:
我有这个需要在 Node.js 中重现的 shell sn-p
echo "hellokev" | openssl dgst -binary -sha1 -hmac "mysecret" | openssl base64;
我当前的节点尝试是:
node -e "
var crypto = require('crypto');
var credential = crypto.createHmac('sha1', 'mysecret').update('hellokev').digest('base64')
console.log(credential);
";
不会产生相同的输出。我错过了什么?
【问题讨论】:
标签: node.js linux bash openssl cryptography