Spaces:
Paused
Paused
Download src/lib/utils/sha256.ts from vollsteksolutions/test: direct link, hf CLI and curl.
- Browser
- Download file 342 Bytes
-
https://huggingface.co/spaces/vollsteksolutions/test/resolve/main/src/lib/utils/sha256.ts
- Command line
-
hf download hf://spaces/vollsteksolutions/test/src/lib/utils/sha256.ts
-
curl -L -o sha256.ts https://huggingface.co/spaces/vollsteksolutions/test/resolve/main/src/lib/utils/sha256.ts
342 Bytes
| 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; | |
| } | |