123456789101112131415161718192021 |
- /*
- * @Description:
- * @Autor: kindring
- * @Date: 2022-01-24 14:47:56
- * @LastEditors: kindring
- * @LastEditTime: 2022-01-24 14:48:03
- * @LastDescript:
- */
- // 引入crypto模块
- const crypto = require('crypto');
- // 规定使用哈希算法中的MD5算法
- const hash = crypto.createHash('md5');
- // 可任意多次调用update(),效果相当于多个字符串相加
- hash.update('987653abc');
- hash.update('123456789');
- // 最终加密的字符串为'987653abc123456789',hash.digest('hex')表示输出的格式为16进制
- const a = hash.digest('hex');
- console.log(a); // c3b93d3065f112b02ac70e09762469b0
|