feat(lib): 添加哈希辅助库

This commit is contained in:
MoonLeeeaf
2025-03-16 23:48:19 +08:00
parent a41f968994
commit c82d4e5493

10
server/lib/crypto.js Normal file
View File

@@ -0,0 +1,10 @@
import crypto from 'node:crypto'
/**
* 获取 Sha-256 哈希
* @param { crypto.BinaryLike } data
* @returns
*/
export function sha256(data) {
return crypto.createHash('sha256').update(data).digest().toString('hex')
}