1const crypto = require('crypto');
2
3const secret = 'abcdefg';
4const hash = crypto.createHmac('sha256', secret)
5 .update('I love cupcakes')
6 .digest('hex');
7console.log(hash);
8// Prints:
9// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
10
1require("crypto").createHmac("sha256", "password")
2 .update("If you love node so much why don't you marry it?")
3 .digest("hex");
4