backsplash-app
Version:
An AI powered wallpaper app.
12 lines (10 loc) • 400 B
text/typescript
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);
}