diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2024-01-11 07:37:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 15:37:25 -0700 |
commit | 515a34b4de222e35c7ade1b92614d746e73d4c2e (patch) | |
tree | 8284201fc826a33f12597959a8a8be14e0f524bd /ext/node/polyfills/internal/crypto/pbkdf2.ts | |
parent | d4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff) |
refactor: use `core.ensureFastOps()` (#21888)
Diffstat (limited to 'ext/node/polyfills/internal/crypto/pbkdf2.ts')
-rw-r--r-- | ext/node/polyfills/internal/crypto/pbkdf2.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/node/polyfills/internal/crypto/pbkdf2.ts b/ext/node/polyfills/internal/crypto/pbkdf2.ts index e365ef3f0..47c66043c 100644 --- a/ext/node/polyfills/internal/crypto/pbkdf2.ts +++ b/ext/node/polyfills/internal/crypto/pbkdf2.ts @@ -3,13 +3,15 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials +import { core } from "ext:core/mod.js"; +const { + op_node_pbkdf2, + op_node_pbkdf2_async, +} = core.ensureFastOps(); + import { Buffer } from "node:buffer"; import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts"; -const { core } = globalThis.__bootstrap; -const { ops } = core; -const { op_node_pbkdf2_async } = core.ensureFastOps(); - export const MAX_ALLOC = Math.pow(2, 30) - 1; export type NormalizedAlgorithms = @@ -51,7 +53,7 @@ export function pbkdf2Sync( } const DK = new Uint8Array(keylen); - if (!ops.op_node_pbkdf2(password, salt, iterations, digest, DK)) { + if (!op_node_pbkdf2(password, salt, iterations, digest, DK)) { throw new Error("Invalid digest"); } |