如何使用Node.js的加密来创建一个HMAC-SHA1哈希?如何使用、创建一个、Node、哈希

由网友(爱的分界线。)分享简介:我要创建我爱蛋糕(用钥匙abcdeg签署)I want to create a hash of "I love cupcakes" (signed with the key "abcdeg")我怎么可以创建一个散列,使用Node.js的加密?How can I create that hash , using N...

我要创建我爱蛋糕(用钥匙abcdeg签署)

I want to create a hash of "I love cupcakes" (signed with the key "abcdeg")

我怎么可以创建一个散列,使用Node.js的加密?

How can I create that hash , using Node.js Crypto?

推荐答案

文档加密: http://nodejs.org/api /crypto.html

var crypto = require('crypto')
  , text = 'I love cupcakes'
  , key = 'abcdeg'
  , hash

hash = crypto.createHmac('sha1', key).update(text).digest('hex')
阅读全文

相关推荐

最新文章