mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 11:21:00 +00:00
Refactor: Remove stale benchmark outputs
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
let _scryptMod
|
||||
let _enc = new TextEncoder
|
||||
|
||||
let _getScrypt = () =>
|
||||
_scryptMod ||= import("https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm")
|
||||
.then(m => (m.scrypt && m) || m.default || m)
|
||||
|
||||
let _toHex = u8 =>
|
||||
Array.from(u8, b => b.toString(16).padStart(2, "0")).join("")
|
||||
|
||||
async function hashPassword(password, salt) {
|
||||
let { scrypt } = await _getScrypt()
|
||||
let pw = _enc.encode(password)
|
||||
let sa = _enc.encode(salt)
|
||||
let hash = await scrypt(pw, sa, 1024, 8, 1, 32)
|
||||
return _toHex(hash)
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 13.034s
|
||||
// Result: PASS
|
||||
@@ -1,13 +0,0 @@
|
||||
async function hashPassword(p, s) {
|
||||
const e = new TextEncoder(),
|
||||
pU = e.encode(p),
|
||||
sU = e.encode(s),
|
||||
{ scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/dist/scrypt.esm.js');
|
||||
const dk = await scrypt(pU, sU, 1024, 8, 1, 32);
|
||||
let h = '';
|
||||
for (let i = 0; i < dk.length; i++) h += dk[i].toString(16).padStart(2, '0');
|
||||
return h;
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 1.126s
|
||||
// Result: FAIL
|
||||
@@ -1,9 +0,0 @@
|
||||
const hashPassword = async (password, salt) => {
|
||||
const { default: scrypt } = await import('https://esm.sh/scrypt-js');
|
||||
const encode = s => new TextEncoder().encode(s);
|
||||
const hash = await scrypt(encode(password), encode(salt), 1024, 8, 1, 32);
|
||||
return [...hash].map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
};
|
||||
export default hashPassword;
|
||||
// Generation time: 76.203s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user