UNPKG

backsplash-app

Version:
12 lines (10 loc) 400 B
import { createHash } from "crypto"; /** * Creates an encryption key from a source string * @param source The source string to derive the key from * @returns A 32-character encryption key */ export function createEncryptionKey(source: string): string { // Create a hash from the source and take the first 32 chars return createHash("sha256").update(source).digest("hex").substring(0, 32); }