From 4061d6964fc085f8dc018eabd83c3aa99dc758aa Mon Sep 17 00:00:00 2001 From: Opliko Date: Thu, 11 Apr 2024 16:02:04 +0200 Subject: [PATCH] test: organize benchmarks better and add test against other libraries --- deno.lock | 83 ++++++++++++++- lib/scrypt_bench.ts | 242 ++++++++++++++++++++++---------------------- 2 files changed, 202 insertions(+), 123 deletions(-) diff --git a/deno.lock b/deno.lock index 71f37e2..074c388 100644 --- a/deno.lock +++ b/deno.lock @@ -7,7 +7,11 @@ "jsr:@std/crypto@0.218.2": "jsr:@std/crypto@0.218.2", "jsr:@std/encoding@0.218.2": "jsr:@std/encoding@0.218.2", "jsr:@std/encoding@^0.218.2": "jsr:@std/encoding@0.218.2", - "jsr:@std/fmt@^0.218.2": "jsr:@std/fmt@0.218.2" + "jsr:@std/fmt@^0.218.2": "jsr:@std/fmt@0.218.2", + "npm:@noble/hashes": "npm:@noble/hashes@1.4.0", + "npm:@types/node": "npm:@types/node@18.16.19", + "npm:hash-wasm": "npm:hash-wasm@4.11.0", + "npm:scrypt": "npm:scrypt@6.0.3" }, "jsr": { "@std/assert@0.218.2": { @@ -29,9 +33,82 @@ "@std/fmt@0.218.2": { "integrity": "99526449d2505aa758b6cbef81e7dd471d8b28ec0dcb1491d122b284c548788a" } + }, + "npm": { + "@noble/hashes@1.4.0": { + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dependencies": {} + }, + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + }, + "hash-wasm@4.11.0": { + "integrity": "sha512-HVusNXlVqHe0fzIzdQOGolnFN6mX/fqcrSAOcTBXdvzrXVHwTz11vXeKRmkR5gTuwVpvHZEIyKoePDvuAR+XwQ==", + "dependencies": {} + }, + "nan@2.19.0": { + "integrity": "sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==", + "dependencies": {} + }, + "scrypt@6.0.3": { + "integrity": "sha512-NDrWb9hCm6Ev170XYVl7TSgu4R44Rjc8EVw1ce0TMN8EkfLvkhlwcfp61OVNc8EJDiHaQwVErn1fIU0RO3kSZw==", + "dependencies": { + "nan": "nan@2.19.0" + } + } } }, "remote": { + "https://deno.land/std@0.160.0/hash/sha256.ts": "aa9479c260f41b72c639f36c3e4bc9319940b5d2e52fe793ebe3dc646d12832f", + "https://deno.land/std@0.162.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.162.0/flags/mod.ts": "e35fbfc7e90db230f7a4a99bc2888c60d9ccbff415cb930350366a38b0de79c7", + "https://deno.land/std@0.218.2/assert/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975", + "https://deno.land/std@0.218.2/assert/_diff.ts": "dcc63d94ca289aec80644030cf88ccbf7acaa6fbd7b0f22add93616b36593840", + "https://deno.land/std@0.218.2/assert/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4", + "https://deno.land/std@0.218.2/assert/assert.ts": "bec068b2fccdd434c138a555b19a2c2393b71dfaada02b7d568a01541e67cdc5", + "https://deno.land/std@0.218.2/assert/assert_almost_equals.ts": "8b96b7385cc117668b0720115eb6ee73d04c9bcb2f5d2344d674918c9113688f", + "https://deno.land/std@0.218.2/assert/assert_array_includes.ts": "1688d76317fd45b7e93ef9e2765f112fdf2b7c9821016cdfb380b9445374aed1", + "https://deno.land/std@0.218.2/assert/assert_equals.ts": "4497c56fe7d2993b0d447926702802fc0becb44e319079e8eca39b482ee01b4e", + "https://deno.land/std@0.218.2/assert/assert_exists.ts": "24a7bf965e634f909242cd09fbaf38bde6b791128ece08e33ab08586a7cc55c9", + "https://deno.land/std@0.218.2/assert/assert_false.ts": "6f382568e5128c0f855e5f7dbda8624c1ed9af4fcc33ef4a9afeeedcdce99769", + "https://deno.land/std@0.218.2/assert/assert_greater.ts": "4945cf5729f1a38874d7e589e0fe5cc5cd5abe5573ca2ddca9d3791aa891856c", + "https://deno.land/std@0.218.2/assert/assert_greater_or_equal.ts": "573ed8823283b8d94b7443eb69a849a3c369a8eb9666b2d1db50c33763a5d219", + "https://deno.land/std@0.218.2/assert/assert_instance_of.ts": "72dc1faff1e248692d873c89382fa1579dd7b53b56d52f37f9874a75b11ba444", + "https://deno.land/std@0.218.2/assert/assert_is_error.ts": "6596f2b5ba89ba2fe9b074f75e9318cda97a2381e59d476812e30077fbdb6ed2", + "https://deno.land/std@0.218.2/assert/assert_less.ts": "2b4b3fe7910f65f7be52212f19c3977ecb8ba5b2d6d0a296c83cde42920bb005", + "https://deno.land/std@0.218.2/assert/assert_less_or_equal.ts": "b93d212fe669fbde959e35b3437ac9a4468f2e6b77377e7b6ea2cfdd825d38a0", + "https://deno.land/std@0.218.2/assert/assert_match.ts": "ec2d9680ed3e7b9746ec57ec923a17eef6d476202f339ad91d22277d7f1d16e1", + "https://deno.land/std@0.218.2/assert/assert_not_equals.ts": "ac86413ab70ffb14fdfc41740ba579a983fe355ba0ce4a9ab685e6b8e7f6a250", + "https://deno.land/std@0.218.2/assert/assert_not_instance_of.ts": "8f720d92d83775c40b2542a8d76c60c2d4aeddaf8713c8d11df8984af2604931", + "https://deno.land/std@0.218.2/assert/assert_not_match.ts": "b4b7c77f146963e2b673c1ce4846473703409eb93f5ab0eb60f6e6f8aeffe39f", + "https://deno.land/std@0.218.2/assert/assert_not_strict_equals.ts": "da0b8ab60a45d5a9371088378e5313f624799470c3b54c76e8b8abeec40a77be", + "https://deno.land/std@0.218.2/assert/assert_object_match.ts": "e85e5eef62a56ce364c3afdd27978ccab979288a3e772e6855c270a7b118fa49", + "https://deno.land/std@0.218.2/assert/assert_rejects.ts": "5206ac37d883797d9504e3915a0c7b692df6efcdefff3889cc14bb5a325641dd", + "https://deno.land/std@0.218.2/assert/assert_strict_equals.ts": "0425a98f70badccb151644c902384c12771a93e65f8ff610244b8147b03a2366", + "https://deno.land/std@0.218.2/assert/assert_string_includes.ts": "dfb072a890167146f8e5bdd6fde887ce4657098e9f71f12716ef37f35fb6f4a7", + "https://deno.land/std@0.218.2/assert/assert_throws.ts": "31f3c061338aec2c2c33731973d58ccd4f14e42f355501541409ee958d2eb8e5", + "https://deno.land/std@0.218.2/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8", + "https://deno.land/std@0.218.2/assert/equal.ts": "fae5e8a52a11d3ac694bbe1a53e13a7969e3f60791262312e91a3e741ae519e2", + "https://deno.land/std@0.218.2/assert/fail.ts": "f310e51992bac8e54f5fd8e44d098638434b2edb802383690e0d7a9be1979f1c", + "https://deno.land/std@0.218.2/assert/mod.ts": "325df8c0683ad83a873b9691aa66b812d6275fc9fec0b2d180ac68a2c5efed3b", + "https://deno.land/std@0.218.2/assert/unimplemented.ts": "47ca67d1c6dc53abd0bd729b71a31e0825fc452dbcd4fde4ca06789d5644e7fd", + "https://deno.land/std@0.218.2/assert/unreachable.ts": "3670816a4ab3214349acb6730e3e6f5299021234657eefe05b48092f3848c270", + "https://deno.land/std@0.218.2/crypto/_fnv/fnv32.ts": "ba2c5ef976b9f047d7ce2d33dfe18671afc75154bcf20ef89d932b2fe8820535", + "https://deno.land/std@0.218.2/crypto/_fnv/fnv64.ts": "580cadfe2ff333fe253d15df450f927c8ac7e408b704547be26aab41b5772558", + "https://deno.land/std@0.218.2/crypto/_fnv/mod.ts": "8dbb60f062a6e77b82f7a62ac11fabfba52c3cd408c21916b130d8f57a880f96", + "https://deno.land/std@0.218.2/crypto/_fnv/util.ts": "27b36ce3440d0a180af6bf1cfc2c326f68823288540a354dc1d636b781b9b75f", + "https://deno.land/std@0.218.2/crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs": "76c727912539737def4549bb62a96897f37eb334b979f49c57b8af7a1617635e", + "https://deno.land/std@0.218.2/crypto/_wasm/mod.ts": "c55f91473846827f077dfd7e5fc6e2726dee5003b6a5747610707cdc638a22ba", + "https://deno.land/std@0.218.2/crypto/crypto.ts": "b7bacddd990ad4193556697b88c7291ed61edc145fafbc060559984f3e8e4977", + "https://deno.land/std@0.218.2/crypto/mod.ts": "7e7971e8abd90addbb02640e43c124e28d10b07e88b61851049c40fc2b5eb04b", + "https://deno.land/std@0.218.2/crypto/timing_safe_equal.ts": "bc3622b5aec05e2d8b735bf60633425c34333c06cfb6c4a9f102e4a0f3931ced", + "https://deno.land/std@0.218.2/crypto/unstable_keystack.ts": "c2a6f6ed67a4e78745e3c9b490ebb7c12f6066f5c2fe0c69d353961909dc82dd", + "https://deno.land/std@0.218.2/encoding/_util.ts": "beacef316c1255da9bc8e95afb1fa56ed69baef919c88dc06ae6cb7a6103d376", + "https://deno.land/std@0.218.2/encoding/base64.ts": "b0fe5f1c55571dc9f091abc7d4830482f2f67ab4308c9c1b57071e770b7dcc74", + "https://deno.land/std@0.218.2/encoding/base64url.ts": "9cc46cf510436be63ac00ebf97a7de1993e603ca58e1853b344bf90d80ea9945", + "https://deno.land/std@0.218.2/encoding/hex.ts": "e939f50d55be48a1fe42fecaaecdb54353df38e831c47f374be7e6fdbe61510e", + "https://deno.land/std@0.218.2/fmt/colors.ts": "d239d84620b921ea520125d778947881f62c50e78deef2657073840b8af9559a", "https://deno.land/std@0.222.1/assert/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975", "https://deno.land/std@0.222.1/assert/_diff.ts": "4bf42969aa8b1a33aaf23eb8e478b011bfaa31b82d85d2ff4b5c4662d8780d2b", "https://deno.land/std@0.222.1/assert/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4", @@ -80,7 +157,9 @@ "https://deno.land/x/scrypt@v4.3.4/lib/helpers.ts": "ab937ba5bc709a06ee91ea9dc47e5003cc333c8ff6e50fb1fe802c0e9694bac8", "https://deno.land/x/scrypt@v4.3.4/lib/hmac.ts": "54b688de699b29a139c4aa68655f54c73eaca5ac54006da25bb0049785c2a3f3", "https://deno.land/x/scrypt@v4.3.4/lib/scrypt.ts": "af42fa97e6fc7b64a1abae2899c084a6c798f37c8095c85c937cef1543134ce2", - "https://deno.land/x/scrypt@v4.3.4/mod.ts": "03f0dd67c896c503afafb3bfa7ddac1dd64bf7253a933e1cc87651f6b03ca7bd" + "https://deno.land/x/scrypt@v4.3.4/mod.ts": "03f0dd67c896c503afafb3bfa7ddac1dd64bf7253a933e1cc87651f6b03ca7bd", + "https://deno.land/x/scrypto@v1.0.0/main.ts": "2f5733cbbef436d87e128204df4baf8de0177bd2ce38601e1a83e866bc828d0c", + "https://deno.land/x/scrypto@v1.0.0/scrypt.ts": "8db05b7f839f9442fbd2df1e7e93b7245a409abbf2a6a7ba28e71f8ff0ffbf33" }, "workspace": { "dependencies": [ diff --git a/lib/scrypt_bench.ts b/lib/scrypt_bench.ts index 630524b..5a52d30 100644 --- a/lib/scrypt_bench.ts +++ b/lib/scrypt_bench.ts @@ -4,140 +4,140 @@ */ import { scrypt as scryptOld } from "https://deno.land/x/scrypt@v4.3.4/lib/scrypt.ts"; 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" + +function scryptNode( + password: string, + salt: string, + N: number, + r: number, + p: number, + dklen: number = 64, +) { + return new Promise((resolve) => + scryptNodeRaw(password, salt, dklen, { N, r, p }, resolve) + ); +} + +function scrypto( + password: string, + salt: string, + N: number, + r: number, + p: number, + dkLen: number = 64, +) { + return scryptoRaw(password, salt, { N, r, p, dkLen}) +} + +function scryptWasm ( + password: string, + salt: string, + N: number, + r: number, + p: number, + dkLen: number = 64, +) { + return scryptWasmRaw({password, salt, costFactor: N, blockSize: r, parallelism: p, hashLength: dkLen}); +} + +const scryptImplementations = { + "current": scrypt, + "last version": scryptOld, + "node": scryptNode, + "scrypto": scrypto, + "hash-wasm": scryptWasm, +}; + const extremeSalt = `IkjpewCbNm4A7cuY1VL9KC3y92blEthtLf9Cet6uEoTxz5cyF660da2zeci42fYwVCVwsKogETMCXupSZZAUh6a80ZnnBTk17B3UTCSVQPpYfL8GktJ2BDokE7ox2hV8OwwUT1hFvCuJqwHZpRvZw1RNCO6HfukPdgMHhq9rWLTXXUNwrIjlmkeydKGFJz2mS1xFcvLQtle4olJVK0SXXXYHAigBfpYxxSC2acvoxuacWcXhzSSRZAMysU2J7zDfXdxnYoqz50rvmvi36g7t2WDSAdzZ44JpxVcc3bYD7xYI3UgfVMPOfeblzwJi455QIurHzDuXEUNS0tZX1kWwZ0XcNSCwGzPs7WSVHxHc0KVUNhwSz16wDYFK4pYeA29ThXgFiFICSLVshiRrCfuzRthW7IZtRa9efcf4nFJsVBk51jpHY0b8CLhARrQU92mlBULwmJKe8DgST3Vn9rva98E9jk4y7NfSb4i9g74OjuFQ8yRO3BHksBZoVtBl4wUppM2hsLt72LZKA0ZsaWW7dG9a1bgWUkBBRG5OwzARenDqQIA2Gp5V4JsXuUUYNDylCelkLUVfS7hB1AZHtnIgwVqTaGDxl7nNZGKpAx6MrOd40laTUhrtZo4prwFZROHPNVJGQk2PQDgwqxX5SWoBTK8cCCzrbGBfHq9r8BwBvSVdeQ7bgjUW2j7NCapHHZ6filzxZaVsLsEITGZNcK0t5DdSnaDLRxyOn21ncKVIyZfOdlvpytvqpQaH5RWu4G50IPkEevue8KenXpGLP0pmEseBf6eX02rlN9arqZ4HJWmD7RbAChs7OJwfKlNIawb0V3G3N0eJeXiRsYOk10GIb91pyZRLSr2AJDtiWCcMuOWZfgLVHIrUVftfh9iXmRk2RAT1sigivbNtdqcF2cVvbTVMUCe7MIPRt4dGqwOQqdReGjPy9p1CNfKfJBIgW0xhYsOGMkcUqSurHxPl4wTOnMBx8vEZQsqJCZomENA1`; const extremePassword = `TFImeWrtF2kOIvDjG4P0ybmMrNOq0bQ0aERcC69iHflECWrwuSMO4JPD3Ng5HwNXZrCpHyEwviW8zly3WLsQ6zJ60lnfwhVRdkEQCsFiH4NvGl0tCAuty9Rruf47WHeE3GK7qAJwhcXHx3FCJgWN8KHdoy3vn2zUKJlhhjSFGANJdVYQGSaQTmtoJdhcemmYT5hprkALp7Q9vMwCk9hDvV5vB0evXfxqG0dFV3MPJmywwWAUJEi5MyM2Pio7fL50M5ohPWFmUllpa6G5pVBhi26GtOy6sM3GDGHmnohavtsMvTeRcMX1ds4HWA9U3vH7urQ3XGkCUzulB6WxuxHn8Z3fRz3BL6MZI0EReep2qUVaqJn8onzsI6da6pU6iDtRbufWxi0q8XN1S3BCtFGjzaTU12nvfg5js53PiSw1KUnZj2thKxWtnKcpwzbXdTuuZ9GVhZHIMcOXXrDR0rj539ZLAVyJmqwDOMjTsqPN7BY522PcJHoTElSRNRAsAsFx2m7h9brhcZXOgV1PZohJsdQS7RWhAl9EYBkgF8WCgGw9DXidVduIIHDlEd7mAVJfo9HYX85kFcwrLEpuPiFxfNhubeDpeBu2FAbAo6DNHFlqXUUnyKvMbzptcgisSr2V1pwykB6uLVrwx3AceRnyqg5flldmfsSKw0AFZ4PagGMJuFDMGrV29Vmqhv61SRL9in0ngZx0gJ2vKv26qS3jGN72UUsbkysuGNz6ul0D5jIapvIcCTncIiXSY24pPctxFsawcXvSNw4jEKccsHCTZF0gri6iFS7JqqQd87FNowbrug6sIWSwiWHYGN1VfSwuE5plQHVvNCHNZnMBBIoaMWh45lhtlfCWdUwVpjjK5dAUcOtKftJ2hcl4mIlxs7Fy8ASWhYvWAbpp3fRgmAeTRYAFEwMohN9b03iXyDSNFIeZtQoaL7HYFVWoXV4BfBVlR3CvNIwp6OPBAFFSDlSn9CZU06UziY1tSwqBzkCD`; -Deno.bench("small scrypt - last version", { group: "small scrypt" }, () => { - scryptOld("password", "salt", 1024, 8, 1, 64); -}); -Deno.bench("small scrypt", { group: "small scrypt", baseline: true }, () => { - scrypt("password", "salt", 1024, 8, 1, 64); -}); - -Deno.bench("small scrypt - last version (longer password and salt)", { - group: "small scrypt (longer password and salt)", -}, () => { - scryptOld( - "long password to test that", - "long salt to test that", - 1024, - 8, - 1, - 64, - ); -}); -Deno.bench("small scrypt (longer password and salt)", { - group: "small scrypt (longer password and salt)", - baseline: true, -}, () => { - scrypt( - "long password to test that", - "long salt to test that", - 1024, - 8, - 1, - 64, - ); -}); - -Deno.bench("small scrypt - last version (extremely long password and salt)", { - group: "small scrypt (extremely long password and salt)", -}, () => { - scryptOld(extremePassword, extremeSalt, 1024, 8, 1, 64); -}); -Deno.bench("small scrypt (extremely long password and salt)", { - group: "small scrypt (extremely long password and salt)", - baseline: true, -}, () => { - scrypt(extremePassword, extremeSalt, 1024, 8, 1, 64); -}); - -Deno.bench("standard scrypt - last version", { group: "scrypt" }, () => { - scryptOld("password", "salt", 16384, 8, 1, 64); -}); -Deno.bench("standard scrypt", { group: "scrypt", baseline: true }, () => { - scrypt("password", "salt", 16384, 8, 1, 64); -}); +for (const [name, implementation] of Object.entries(scryptImplementations)) { + Deno.bench(`small scrypt - ${name}`, { + group: "small scrypt", + baseline: name === "current", + }, async () => { + await implementation("password", "salt", 1024, 8, 1, 64); + }); -Deno.bench( - "standard scrypt - last version (longer password and salt)", - { group: "scrypt (longer password and salt)" }, - () => { - scryptOld( + Deno.bench(`small scrypt - ${name} (longer password and salt)`, { + group: "small scrypt (longer password and salt)", + baseline: name === "current", + }, async () => { + await implementation( "long password to test that", "long salt to test that", - 16384, + 1024, 8, 1, 64, ); - }, -); -Deno.bench( - "standard scrypt (longer password and salt)", - { group: "scrypt (longer password and salt)", baseline: true }, - () => { - scrypt( - "long password to test that", - "long salt to test that", - 16384, - 8, - 1, - 64, - ); - }, -); + }); + + Deno.bench(`small scrypt - ${name} (extremely long password and salt)`, { + group: "small scrypt (extremely long password and salt)", + baseline: name === "current", + }, async () => { + await implementation(extremePassword, extremeSalt, 1024, 8, 1, 64); + }); -Deno.bench( - "standard scrypt - last version (extremely long password and salt)", - { - group: "scrypt (extremely long password and salt)", - }, - () => { - scryptOld(extremePassword, extremeSalt, 16384, 8, 1, 64); - }, -); -Deno.bench("standard scrypt (extremely long password and salt)", { - group: "scrypt (extremely long password and salt)", - baseline: true, -}, () => { - scrypt(extremePassword, extremeSalt, 16384, 8, 1, 64); -}); + Deno.bench(`standard scrypt - ${name}`, { + group: "scrypt", + baseline: name === "current", + }, async () => { + await implementation("password", "salt", 16384, 8, 1, 64); + }); + Deno.bench( + `standard scrypt - ${name} (longer password and salt)`, + { + group: "scrypt (longer password and salt)", + baseline: name === "current", + }, + async () => { + await implementation( + "long password to test that", + "long salt to test that", + 16384, + 8, + 1, + 64, + ); + }, + ); + + Deno.bench( + `standard scrypt - ${name} (extremely long password and salt)`, + { + group: "scrypt (extremely long password and salt)", + baseline: name === "current", + }, + async () => { + await implementation(extremePassword, extremeSalt, 16384, 8, 1, 64); + }, + ); -Deno.bench("large n scrypt - last version (4x standard)", { - group: "large n scrypt", -}, () => { - scryptOld("password", "salt", 65536, 8, 1, 64); -}); -Deno.bench("large n scrypt (4x standard)", { - group: "large n scrypt", - baseline: true, -}, () => { - scrypt("password", "salt", 65536, 8, 1, 64); -}); + Deno.bench(`large n scrypt - ${name} (4x standard)`, { + group: "large n scrypt", + baseline: name === "current", + }, async () => { + await implementation("password", "salt", 65536, 8, 1, 64); + }); -Deno.bench("large r scrypt - last version (4x standard)", { - group: "large r scrypt", -}, () => { - scryptOld("password", "salt", 16384, 32, 1, 64); -}); -Deno.bench("large r scrypt (4x standard)", { - group: "large r scrypt", - baseline: true, -}, () => { - scrypt("password", "salt", 16384, 32, 1, 64); -}); + Deno.bench(`large r scrypt - ${name} (4x standard)`, { + group: "large r scrypt", + baseline: name === "current", + }, async () => { + await implementation("password", "salt", 16384, 32, 1, 64); + }); -Deno.bench("large p scrypt - last version (4x standard)", { - group: "large p scrypt", -}, () => { - scryptOld("password", "salt", 16384, 8, 4, 64); -}); -Deno.bench("large p scrypt (4x standard)", { - group: "large p scrypt", - baseline: true, -}, () => { - scrypt("password", "salt", 16384, 8, 4, 64); -}); + Deno.bench(`large p scrypt - ${name} (4x standard)`, { + group: "large p scrypt", + baseline: name === "current", + }, async () => { + await implementation("password", "salt", 16384, 8, 4, 64); + }); +}