新建crypto.js
新建test.js
const crypto = require(‘./crypto’);
const secret = ‘abcdefg’;
const hash = crypto.createHmac(‘sha256’, secret);//加密格式sha256
.update(‘I love cupcakes’)
.digest(‘hex’);
console.log(hash); //加密功能
新建crypto.js
新建test.js
const crypto = require(‘./crypto’);
const secret = ‘abcdefg’;
const hash = crypto.createHmac(‘sha256’, secret);//加密格式sha256
.update(‘I love cupcakes’)
.digest(‘hex’);
console.log(hash); //加密功能
相关文章: