更新版本至 0.0.48,升级依赖项,优化哈希函数实现,新增 QueryMark 类及相关功能

This commit is contained in:
2026-02-14 01:11:03 +08:00
parent e4990d5e3d
commit d2ffc8d8ec
5 changed files with 195 additions and 38 deletions

View File

@@ -1,13 +1,12 @@
import MD5 from 'crypto-js/md5';
import SparkMD5 from 'spark-md5';
export const hashContent = (str: string | Blob | Buffer): Promise<string> | string => {
if (typeof str === 'string') {
return MD5(str).toString();
return SparkMD5.hash(str);
} else if (str instanceof Blob) {
return hashBlob(str);
} else if (Buffer.isBuffer(str)) {
return MD5(str.toString()).toString();
return SparkMD5.hash(str.toString());
}
console.error('hashContent error: input must be a string, Blob, or Buffer');
return '';