1// generate a hash from string
2var crypto = require('crypto'),
3 text = 'hello bob',
4 key = 'mysecret key'
5
6// create hahs
7var hash = crypto.createHmac('sha512', key)
8hash.update(text)
9var value = hash.digest('hex')
10
11// print result
12console.log(value);
13