📅  最后修改于: 2022-03-11 15:03:05.259000             🧑  作者: Mango
// generate a hash from string
var crypto = require('crypto'),
text = 'hello bob',
key = 'mysecret key'
// create hahs
var hash = crypto.createHmac('sha512', key)
hash.update(text)
var value = hash.digest('hex')
// print result
console.log(value);