I have ruby 1.8.7 code that create hmac with sha1
key= '123'
digest = Digest::SHA1.new
digest << 'test string'
digest << key
result = digest.hexdigest
# "c1bdfd602e1581f1ab91928e2c3fd371a1e63a5c"
I want to replicate this with node.js:
key= '123'; myhmac = crypto.createHmac('sha1', key); result = myhmac.update('test string').digest('hex'); // 'a145f4d366e9e4e96b80bc427144ba77b3c7151a'
But the result is different. What should I do in nodejs to have the same result as from ruby?