Files
famdone/frontend/src/lib/crypto.ts
T
2026-07-29 09:41:52 +01:00

10 lines
271 B
TypeScript

export async function sha256(input: string): Promise<string> {
const hash = await globalThis.crypto.subtle.digest(
'SHA-256',
new TextEncoder().encode(input),
);
return Array.from(new Uint8Array(hash))
.map((b) => b.toString(16).padStart(2, '0'))
.join('');
}