import { scrypt } from "@noble/hashes/scrypt"; import { hex } from "@better-auth/utils/hex"; const config = { N: 16384, r: 16, p: 1, dkLen: 64 }; function hashPassword(password) { const salt = hex.encode(crypto.getRandomValues(new Uint8Array(16))); const key = scrypt(password.normalize("NFKC"), salt, { N: config.N, p: config.p, r: config.r, dkLen: config.dkLen, maxmem: 128 * config.N * config.r * 2 }); return `${salt}:${hex.encode(key)}`; } const hashed = hashPassword("admin"); console.log("Hash for 'admin':", hashed);