From c82d4e549394612cd28ff6b162f92b5dcfb59ef4 Mon Sep 17 00:00:00 2001 From: MoonLeeeaf <150461955+MoonLeeeaf@users.noreply.github.com> Date: Sun, 16 Mar 2025 23:48:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(lib):=20=E6=B7=BB=E5=8A=A0=E5=93=88?= =?UTF-8?q?=E5=B8=8C=E8=BE=85=E5=8A=A9=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/lib/crypto.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 server/lib/crypto.js diff --git a/server/lib/crypto.js b/server/lib/crypto.js new file mode 100644 index 0000000..0e230a5 --- /dev/null +++ b/server/lib/crypto.js @@ -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') +}