内置模块 Crypto
内置模块crypto
- crypto模块主要用途是加密
const crypto = require('crypto');
const password = 'abc123 7sjds';
/**
* createHash:指定加密算法
* update:指定加密的对象
* digest:指定加密使用几进制
*/
const hash = crypto.createHash('sha1').update(password).digest('hex');
console.log(hash);//e4aeea77b4c55d3cdbfbf3577b6cc9384a96bd29