@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 10 lines 575 Bytes
Raw
1 // Alchemy modifications are licensed under Apache-2.0.
2 // This file includes third-party code; see /THIRD_PARTY_LICENSES.md.
3 export async function computeHash(value: string) {
4 const msgUint8 = new TextEncoder().encode(value); // encode as (utf-8) Uint8Array
5 const hashBuffer = await crypto.subtle.digest("SHA-1", msgUint8); // hash the message
6 const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
7 const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join(""); // convert bytes to hex string
8
9 return hashHex;
10 }