Files
lynchmark/tests/10_scrypt_hash/outputs/x-ai_grok-4.1-fast.js
2025-11-20 01:45:32 +00:00

9 lines
412 B
JavaScript

async function hashPassword(password, salt) {
const { scrypt } = await import('https://cdn.skypack.dev/scrypt-js');
const encoder = new TextEncoder();
const pwBuf = encoder.encode(password);
const saltBuf = encoder.encode(salt);
const hashBuf = await scrypt(pwBuf, saltBuf, 1024, 8, 1, 32);
return Array.from(hashBuf).map(b => b.toString(16).padStart(2, '0')).join('');
}
export default hashPassword;