feat: 新增共享加密包并引入 ZIP/PGP 依赖

This commit is contained in:
2026-03-05 16:23:13 +08:00
parent 9d8a38a4c4
commit d2eb98d612
12 changed files with 300 additions and 12 deletions

View File

@@ -0,0 +1,15 @@
import { createHash } from 'node:crypto'
/**
* Compute SHA-256 hash and return raw Buffer.
*/
export const sha256 = (data: string | Buffer): Buffer => {
return createHash('sha256').update(data).digest()
}
/**
* Compute SHA-256 hash and return lowercase hex string.
*/
export const sha256Hex = (data: string | Buffer): string => {
return createHash('sha256').update(data).digest('hex')
}