mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 17:44:57 +08:00
update
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
"use server";
|
||||
import * as crypto from "node:crypto";
|
||||
import { createHash, createHmac } from "node:crypto";
|
||||
// 使用 SHA-256 和 secret 进行 HMAC 加密
|
||||
function sha256(message: any, secret = "", encoding?: string) {
|
||||
return crypto
|
||||
.createHmac("sha256", secret)
|
||||
return createHmac("sha256", secret)
|
||||
.update(message)
|
||||
.digest(encoding as any);
|
||||
}
|
||||
|
||||
// 使用 SHA-256 进行哈希
|
||||
function getHash(message: any, encoding = "hex") {
|
||||
return crypto
|
||||
.createHash("sha256")
|
||||
return createHash("sha256")
|
||||
.update(message)
|
||||
.digest(encoding as any);
|
||||
}
|
||||
|
Reference in New Issue
Block a user