generated from denorg/starter
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add noble-hashes to the test harness
- Loading branch information
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]/main.ts"; | ||
import { scrypt as scryptWasmRaw } from "npm:hash-wasm" | ||
import { scrypt as scryptNobleRaw } from "npm:@noble/hashes/scrypt" | ||
|
||
function scryptNode( | ||
password: string, | ||
|
@@ -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, | ||
}; | ||
|