2
我需要以下Ruby代碼的Node.js的等效:如何使用node.js加密字符串?
require 'openssl'
digest = OpenSSL::Digest::Digest.new('sha1')
signature = OpenSSL::HMAC.hexdigest(digest, 'auth secret', 'some string')
我試着在node.js的下面,但是Ruby的簽名從節點的
var crypto, signature;
crypto = require('crypto');
signature = crypto.createHash("sha1").update('auth secret').update('some string').digest("hex");
看看這個問題:http://stackoverflow.com/questions/4497135/node-js-and-crypto-library – Chance