拆分数据处理分类,新增编码加密、数学计算分类

This commit is contained in:
fofolee
2025-01-08 16:13:50 +08:00
parent 430466c38c
commit 8003497e71
18 changed files with 271 additions and 239 deletions

View File

@@ -0,0 +1,27 @@
const NodeForge = require("node-forge");
const sm3 = require("sm-crypto").sm3;
const hash = {
// MD5 哈希
md5Hash: function (text) {
return NodeForge.md.md5.create().update(text).digest().toHex();
},
// SHA1 哈希
sha1Hash: function (text) {
return NodeForge.md.sha1.create().update(text).digest().toHex();
},
// SHA256 哈希
sha256Hash: function (text) {
return NodeForge.md.sha256.create().update(text).digest().toHex();
},
// SHA512 哈希
sha512Hash: function (text) {
return NodeForge.md.sha512.create().update(text).digest().toHex();
},
// SM3 哈希
sm3Hash: function (text) {
return sm3(text);
},
};
module.exports = hash;