feat(lib): 添加哈希辅助库
This commit is contained in:
10
server/lib/crypto.js
Normal file
10
server/lib/crypto.js
Normal 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')
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user