Skip to content

Commit

Permalink
test: add noble-hashes to the test harness
Browse files Browse the repository at this point in the history
  • Loading branch information
oplik0 committed Apr 11, 2024
1 parent d3bc3ac commit eff0aac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/scrypt_bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { scrypt } from "./scrypt.ts";
import { scrypt as scryptNodeRaw } from "node:crypto";
import { scrypt as scryptoRaw } from "https://deno.land/x/scrypto@v1.0.0/main.ts";
import { scrypt as scryptWasmRaw } from "npm:hash-wasm"
import { scrypt as scryptNobleRaw } from "npm:@noble/hashes/scrypt"

function scryptNode(
password: string,
Expand Down Expand Up @@ -43,10 +44,22 @@ function scryptWasm (
return scryptWasmRaw({password, salt, costFactor: N, blockSize: r, parallelism: p, hashLength: dkLen});
}

function scryptNoble (
password: string,
salt: string,
N: number,
r: number,
p: number,
dkLen: number = 64,
) {
return scryptNobleRaw(password, salt, {N, r, p, dkLen});
}

const scryptImplementations = {
"current": scrypt,
"last version": scryptOld,
"hash-wasm": scryptWasm,
"noble-hashes": scryptNoble,
"node": scryptNode,
"scrypto": scrypto,
};
Expand Down

0 comments on commit eff0aac

Please sign in to comment.