mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-14 22:54:32 +08:00
拆分数据处理分类,新增编码加密、数学计算分类
This commit is contained in:
27
plugin/lib/quickcomposer/coding/hash.js
Normal file
27
plugin/lib/quickcomposer/coding/hash.js
Normal 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;
|
||||
Reference in New Issue
Block a user