【笔记】Nodejs计算字符串的MD5值

前言

Nodejs计算字符串的MD5值

引入模块

1
const crypto = require('crypto');

如果项目中包含同名模块

1
const crypto = require('node:crypto');

计算字符串的MD5值

1
2
const md5 = crypto.createHash("md5");
const result = md5.update("字符串").digest("hex");

完成

参考文献

博客园——chyingp