mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Refactor: Remove stale benchmark outputs
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
async function hashPassword(password, salt) {
|
||||
const { scrypt } = await import("https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm");
|
||||
const enc = new TextEncoder();
|
||||
const passwordBytes = enc.encode(password);
|
||||
const saltBytes = enc.encode(salt);
|
||||
const hash = await scrypt(passwordBytes, saltBytes, 1024, 8, 1, 32);
|
||||
return Array.from(hash, b => b.toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 3.538s
|
||||
// Result: PASS
|
||||
@@ -1,9 +0,0 @@
|
||||
async function hashPassword(password, salt) {
|
||||
const { scrypt } = await import("https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm");
|
||||
const enc = new TextEncoder();
|
||||
const hash = await scrypt(enc.encode(password), enc.encode(salt), 1024, 8, 1, 32);
|
||||
return Array.from(hash, b => b.toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 2.342s
|
||||
// Result: PASS
|
||||
@@ -1,18 +0,0 @@
|
||||
const hashPassword = async (password, salt) => {
|
||||
const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.1.7/+esm');
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
const derivedKey = await scrypt(
|
||||
encoder.encode(password),
|
||||
encoder.encode(salt),
|
||||
1024,
|
||||
8,
|
||||
1,
|
||||
32
|
||||
);
|
||||
|
||||
return Array.from(derivedKey, byte => byte.toString(16).padStart(2, '0')).join('');
|
||||
};
|
||||
export default hashPassword;
|
||||
// Generation time: 9.228s
|
||||
// Result: FAIL
|
||||
@@ -1,13 +0,0 @@
|
||||
async function hashPassword(password, salt) {
|
||||
const scrypt = (await import("https://cdnjs.cloudflare.com/ajax/libs/scrypt-js/0.0.2/index.js")).scrypt;
|
||||
const encoder = new TextEncoder();
|
||||
const passwordBytes = encoder.encode(password);
|
||||
const saltBytes = encoder.encode(salt);
|
||||
const derivedKey = await scrypt(passwordBytes, saltBytes, 1024, 8, 1, 32);
|
||||
return Array.from(derivedKey)
|
||||
.map(b => b.toString(16).padStart(2, '0'))
|
||||
.join('');
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 3.507s
|
||||
// Result: FAIL
|
||||
@@ -1,18 +0,0 @@
|
||||
let _scrypt;
|
||||
|
||||
export async function hashPassword(password, salt) {
|
||||
if (!_scrypt) {
|
||||
const mod = await import('https://cdn.skypack.dev/scrypt-js');
|
||||
_scrypt = mod.default || mod.scrypt;
|
||||
}
|
||||
const hash = await _scrypt(new TextEncoder().encode(password), new TextEncoder().encode(salt), {
|
||||
N: 1024,
|
||||
r: 8,
|
||||
p: 1,
|
||||
dkLen: 32
|
||||
});
|
||||
return [...hash].map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 17.866s
|
||||
// Result: FAIL
|
||||
@@ -1,9 +0,0 @@
|
||||
async function hashPassword(password, salt) {
|
||||
const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/dist/scrypt.min.js');
|
||||
const enc = new TextEncoder();
|
||||
const buf = await scrypt(enc.encode(password), enc.encode(salt), 1024, 8, 1, 32);
|
||||
return Array.from(buf, b => b.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 39.100s
|
||||
// Result: FAIL
|
||||
@@ -1,9 +0,0 @@
|
||||
const enc=new TextEncoder()
|
||||
async function hashPassword(p,s){
|
||||
const{default:scrypt}=await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm')
|
||||
const u=await scrypt(enc.encode(p),enc.encode(s),1024,8,1,32)
|
||||
return[...u].map(x=>x.toString(16).padStart(2,'0')).join('')
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 12.207s
|
||||
// Result: FAIL
|
||||
@@ -1,9 +0,0 @@
|
||||
const hashPassword=async(p,s)=>{
|
||||
const {scrypt}=await import('https://cdn.skypack.dev/scrypt-js')
|
||||
const e=new TextEncoder
|
||||
const h=await scrypt(e.encode(p),e.encode(s),1024,8,1,32)
|
||||
return [...h].map(b=>b.toString(16).padStart(2,'0')).join('')
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 8.405s
|
||||
// Result: PASS
|
||||
@@ -1,24 +0,0 @@
|
||||
const scryptUrl = "https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm";
|
||||
const te = new TextEncoder();
|
||||
const N = 1024, r = 8, p = 1, dkLen = 32;
|
||||
let scryptP;
|
||||
|
||||
const getScrypt = () =>
|
||||
scryptP ??= import(scryptUrl).then(m => {
|
||||
const f = m.scrypt || m.default?.scrypt || m.default;
|
||||
if (typeof f != "function") throw Error("scrypt-js: missing scrypt export");
|
||||
return f;
|
||||
});
|
||||
|
||||
const toHex = u8 =>
|
||||
Array.from(u8, b => b.toString(16).padStart(2, "0")).join("");
|
||||
|
||||
async function hashPassword(password, salt) {
|
||||
if (typeof password != "string" || typeof salt != "string") throw TypeError("Expected (string, string)");
|
||||
const scrypt = await getScrypt();
|
||||
const key = await scrypt(te.encode(password), te.encode(salt), N, r, p, dkLen);
|
||||
return toHex(key);
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 101.462s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user