Spaces:
Runtime error
Runtime error
Download src/lib/utils/sha256.ts from kokofixcomputers/chat-ui: direct link, hf CLI and curl.
- Browser
- Download file 377 Bytes
-
https://huggingface.co/spaces/kokofixcomputers/chat-ui/resolve/main/src/lib/utils/sha256.ts
- Command line
-
hf download hf://spaces/kokofixcomputers/chat-ui/src/lib/utils/sha256.ts
-
curl -L -o sha256.ts https://huggingface.co/spaces/kokofixcomputers/chat-ui/resolve/main/src/lib/utils/sha256.ts
377 Bytes
| import * as crypto from "crypto"; | |
| export async function sha256(input: string): Promise<string> { | |
| const utf8 = new TextEncoder().encode(input); | |
| const hashBuffer = await crypto.subtle.digest("SHA-256", utf8); | |
| const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
| const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join(""); | |
| return hashHex; | |
| } | |