{"_id":"@noble/hashes@2.4.0","bugs":{"url":"https://github.com/paulmillr/noble-hashes/issues"},"dist":{"shasum":"e6a3e98edbed3c8659b28bb8f9b18ca02ec8ea4b","tarball":"http://registry-npm.ywwl.com/@noble/hashes/download/@noble/hashes-2.4.0.tgz","integrity":"sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA==","fileCount":60,"unpackedSize":691646,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@noble%2fhashes@2.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD5/zhgZaTaRKNdw4p94/s5ICjMK4pjrZszeQnHqmhjYAIgFlSsdpDfVMaUE+3CApwSyRdp4t4goJqUge1/zYwWo+g="}],"size":167626,"noattachment":false,"key":"/@noble/hashes/-/@noble/hashes-2.4.0.tgz"},"main":"index.js","name":"@noble/hashes","type":"module","types":"index.d.ts","author":{"url":"https://paulmillr.com","name":"Paul Miller"},"module":"index.js","engines":{"node":">= 20.19.0"},"exports":{".":"./index.js","./_md.js":"./_md.js","./hkdf.js":"./hkdf.js","./hmac.js":"./hmac.js","./sha2.js":"./sha2.js","./sha3.js":"./sha3.js","./eskdf.js":"./eskdf.js","./utils.js":"./utils.js","./argon2.js":"./argon2.js","./blake1.js":"./blake1.js","./blake2.js":"./blake2.js","./blake3.js":"./blake3.js","./legacy.js":"./legacy.js","./pbkdf2.js":"./pbkdf2.js","./scrypt.js":"./scrypt.js","./webcrypto.js":"./webcrypto.js","./sha3-addons.js":"./sha3-addons.js"},"funding":"https://paulmillr.com/funding/","gitHead":"663c2aeeffc308ac0cded59bd32f7c212adacfc2","license":"MIT","scripts":{"test":"node test/index.ts","build":"tsc","check":"jsbt-check","format":"prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'","test:dos":"node test/slow-dos.test.ts","test:kdf":"node test/slow-kdf.test.ts","benchmark":"node benchmark/hashes.ts","test:acvp":"node test/slow-acvp.test.ts","test:slow":"node test/slow-big.test.ts","test:ultra":"node test/slow-ultra.test.ts","build:clean":"rm *.{js,d.ts} 2> /dev/null","benchmark:size":"bismar -bsm","test:ultra:scrypt":"node test/slow-extreme-scrypt.test.ts","benchmark:thirdparty":"cd benchmark/thirdparty; npm ci; JSBT_BENCHMARK_DIMENSIONS='algorithm,buffer,library' node hashes.ts","benchmark:thirdparty-scrypt":"cd benchmark/thirdparty; npm ci; JSBT_BENCHMARK_DIMENSIONS='iters,library' FILTER='async' node scrypt.ts"},"version":"2.4.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a98b5fad-1e33-4917-9ea6-3e8e981d4a09"},"approver":{"name":"paulmillr","email":"paul@paulmillr.com"}},"homepage":"https://paulmillr.com/noble/","keywords":["sha1","sha2","sha3","blake","blake2","blake3","hmac","hkdf","pbkdf2","scrypt","sha256","sha512","keccak","ripemd160","kdf","hash","cryptography","security","noble"],"repository":{"url":"git+https://github.com/paulmillr/noble-hashes.git","type":"git"},"_npmVersion":"12.0.2","description":"Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt","directories":{},"maintainers":[{"name":"paulmillr","email":"paul@paulmillr.com"}],"sideEffects":false,"_nodeVersion":"24.19.0","devDependencies":{"bismar":"0.1.8","prettier":"3.9.6","fast-check":"4.2.0","typescript":"6.0.3","@types/node":"26.2.0","@paulmillr/jsbt":"0.7.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hashes_2.4.0_1787835762470_0.6776881648636013"},"_hasShrinkwrap":false,"readme":"# noble-hashes\n\nAudited & minimal JS implementation of hash functions, MACs and KDFs.\n\n- 🔒 [**Audited**](#security) by an independent security firm\n- 🪶 Minimal: 2.8KB (gzipped) sha256, unused code is excluded from your builds\n- 🏎 Fast: hand-optimized for caveats of JS engines\n- 🔍 Reliable: chained / ACVP tests ensure correctness\n- 🔁 No unrolled loops: makes it easier to verify and reduces source code size up to 5x\n- 🦘 Includes SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF, Scrypt, Argon2\n- 🥈 Wrapper with identical API over native WebCrypto\n\nThe library's initial development was funded by [Ethereum Foundation](https://ethereum.org/).\n\n### This library belongs to _noble_ cryptography\n\n> **noble cryptography** — high-security, easily auditable set of contained cryptographic libraries and tools.\n\n- Zero or minimal dependencies\n- Highly readable TypeScript / JS code\n- PGP-signed releases and transparent NPM builds\n- All libraries:\n  [ciphers](https://github.com/paulmillr/noble-ciphers),\n  [curves](https://github.com/paulmillr/noble-curves),\n  [hashes](https://github.com/paulmillr/noble-hashes),\n  [post-quantum](https://github.com/paulmillr/noble-post-quantum),\n  5kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) /\n  [ed25519](https://github.com/paulmillr/noble-ed25519)\n- WASM version: [awasm-noble](https://github.com/paulmillr/awasm-noble)\n- [Check out the homepage](https://paulmillr.com/noble/)\n  for reading resources, documentation, and apps built with noble\n\n## Usage\n\n> `npm install @noble/hashes`\n\n> `deno add jsr:@noble/hashes`\n\nWe support all major platforms and runtimes.\nFor React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values).\nA standalone file [noble-hashes.js](https://github.com/paulmillr/noble-hashes/releases) is also available.\n\n```js\n// import * from '@noble/hashes'; // Error: use sub-imports, to ensure small app size\nimport { sha256 } from '@noble/hashes/sha2.js';\nconst hash = sha256(Uint8Array.from([0xca, 0xfe, 0x01, 0x23]));\n```\n\n- [sha2: sha256, sha384, sha512](#sha2-sha256-sha384-sha512-and-others)\n- [sha3: FIPS, SHAKE, Keccak](#sha3-fips-shake-keccak)\n- [sha3-addons: cSHAKE, KMAC, KT128, TurboSHAKE](#sha3-addons-cshake-kmac-kt128-turboshake)\n- [blake1, blake2, blake3](#blake1-blake2-blake3)\n- [legacy: sha1, md5, ripemd160](#legacy-sha1-md5-ripemd160)\n- MACs: [hmac](#hmac) | [kmac](#sha3-addons-cshake-kmac-kt128-turboshake) | [blake3 key mode](#blake1-blake2-blake3)\n- KDFs: [hkdf](#hkdf) | [pbkdf2](#pbkdf2) | [scrypt](#scrypt) | [argon2](#argon2) | [eskdf](#eskdf)\n- [webcrypto: friendly wrapper](#webcrypto-friendly-wrapper)\n- [utils](#utils)\n- [Security](#security) | [Speed](#speed) | [Contributing & testing](#contributing--testing) | [License](#license)\n\n### Implementations\n\nHash functions:\n\n- `sha256()`: receive & return `Uint8Array`\n- `sha256.create().update(a).update(b).digest()`: support partial updates\n- `blake3.create({ context: 'e', dkLen: 32 })`: can have options\n- support little-endian architecture; also experimentally big-endian\n- can hash up to 4GB per chunk, with any amount of chunks\n\n#### sha2: sha256, sha384, sha512 and others\n\n```typescript\nimport { sha224, sha256, sha384, sha512, sha512_224, sha512_256 } from '@noble/hashes/sha2.js';\nconst res = sha256(Uint8Array.from([0xbc]));\n```\n\n\n#### sha3: FIPS, SHAKE, Keccak\n\n```typescript\nimport {\n  sha3_224, sha3_256, sha3_384, sha3_512,\n  keccak_224, keccak_256, keccak_384, keccak_512,\n  shake128, shake256,\n} from '@noble/hashes/sha3.js';\nconst s = sha3_256(Uint8Array.from([0x10, 0x20, 0x30]));\nconst shka = shake128(Uint8Array.from([0x10]), { dkLen: 512 });\nconst shkb = shake256(Uint8Array.from([0x30]), { dkLen: 512 });\n```\n\n#### sha3-addons: cSHAKE, KMAC, KT128, TurboSHAKE\n\n```typescript\nimport {\n  cshake128, cshake256, kt128, kt256,\n  keccakprg, kmac128, kmac256,\n  parallelhash256, tuplehash256,\n  turboshake128, turboshake256,\n} from '@noble/hashes/sha3-addons.js';\nconst data = Uint8Array.from([0x10, 0x20, 0x30]);\nconst ec = cshake128(data, { personalization: new TextEncoder().encode('def') });\nconst et = turboshake256(data, { D: 0x05 });\n// tuplehash(['ab', 'c']) !== tuplehash(['a', 'bc']) !== tuplehash([data])\nconst eu = tuplehash256([new TextEncoder().encode('ab'), new TextEncoder().encode('c')]);\n// Not parallel in JS (similar to blake3 / kt128), added for compat\nconst ep = parallelhash256(data, { blockLen: 8 });\nconst ek = kmac256(Uint8Array.from([0xca]), data);\nconst ekt = kt128(data);\nconst p = keccakprg(254);\np.addEntropy();\nconst rand1b = p.randomBytes(32);\n```\n\n#### blake1, blake2, blake3\n\n```typescript\nimport { blake224, blake256, blake384, blake512 } from '@noble/hashes/blake1.js';\nimport { blake2b, blake2s } from '@noble/hashes/blake2.js';\nimport { blake3 } from '@noble/hashes/blake3.js';\nconst ab = Uint8Array.from([0x01]);\nblake256(ab);\n\n// blake2 advanced usage\nconst txt = new TextEncoder();\nblake2s(ab, { key: new Uint8Array(32) }); // blake2b keys can be 64 bytes\nblake2s(ab, { personalization: txt.encode('pers1234') }); // 16 bytes for blake2b\nblake2s(ab, { salt: txt.encode('salt1234') }); // 16 bytes for blake2b\n\n// blake3 advanced usage\nblake3(ab, { dkLen: 256 });\nblake3(ab, { key: new Uint8Array(32) });\nblake3(ab, { context: txt.encode('application-name') });\n```\n\n#### legacy: sha1, md5, ripemd160\n\n```typescript\nimport { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js';\nconst h = sha1(Uint8Array.from([0x10, 0x20, 0x30]));\n```\n\n#### hmac\n\n```typescript\nimport { hmac } from '@noble/hashes/hmac.js';\nimport { sha256 } from '@noble/hashes/sha2.js';\nconst key = new Uint8Array(32).fill(1);\nconst msg = new Uint8Array(32).fill(2);\nconst mac1 = hmac(sha256, key, msg);\nconst mac2 = hmac.create(sha256, key).update(msg).digest();\n```\n\n#### hkdf\n\n```typescript\nimport { hkdf } from '@noble/hashes/hkdf.js';\nimport { randomBytes } from '@noble/hashes/utils.js';\nimport { sha256 } from '@noble/hashes/sha2.js';\nconst inputKey = randomBytes(32);\nconst salt = randomBytes(32);\nconst info = new TextEncoder().encode('application-key');\nconst hk1 = hkdf(sha256, inputKey, salt, info, 32);\n\n// == same as\nimport { extract, expand } from '@noble/hashes/hkdf.js';\nconst prk = extract(sha256, inputKey, salt);\nconst hk2 = expand(sha256, prk, info, 32);\n```\n\n#### pbkdf2\n\n```typescript\nimport { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';\nimport { sha256 } from '@noble/hashes/sha2.js';\nconst pbkey1 = pbkdf2(sha256, 'password', 'salt', { c: 524288, dkLen: 32 });\nconst pbkey2 = await pbkdf2Async(sha256, 'password', 'salt', { c: 524288, dkLen: 32 });\nconst pbkey3 = await pbkdf2Async(sha256, Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), {\n  c: 524288,\n  dkLen: 32,\n});\n```\n\n#### scrypt\n\n```typescript\nimport { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';\nconst scr1 = scrypt('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 });\nconst scr2 = await scryptAsync('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 });\nconst scr3 = await scryptAsync(Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), {\n  N: 2 ** 17,\n  r: 8,\n  p: 1,\n  dkLen: 32,\n  onProgress(percentage) {\n    console.log('progress', percentage);\n  },\n  // maxmem: 128 * 8 * (2 ** 17 + 1 + 1), // 128 * r * (N + p + 1)\n});\n```\n\n- `N, r, p` are work factors. It is common to only adjust N, while keeping `r: 8, p: 1`.\n  See [the blog post](https://blog.filippo.io/the-scrypt-parameters/).\n  JS doesn't support parallelization, making increasing `p` meaningless.\n- `dkLen` is the length of output bytes e.g. `32` or `64`\n- `onProgress` can be used with async version of the function to report progress to a user.\n- `maxmem` prevents DoS and defaults to `1GiB + 2KiB` (`2**30 + 2**11`), enough for `N: 2**20, r: 8, p: 1`. It can be adjusted using formula: `128 * r * (N + p + 1)`\n\nOn Apple M4, `N: 2**16` takes 0.1s and 64MB RAM; each increment of N doubles both,\nup to `N: 2**24` at 27s and 16GB. Mobile phones can be 1x-4x slower.\n\n> [!NOTE]\n> We support N larger than `2**20` where available, however,\n> not all JS engines support >= 2GB ArrayBuffer-s.\n> When using such N, you'll need to manually adjust `maxmem`, using formula above.\n> Other JS implementations don't support large N-s.\n\n#### argon2\n\n```ts\nimport { argon2d, argon2i, argon2id } from '@noble/hashes/argon2.js';\n// Defaults to t=3, m=1GiB (specified in KiB), p=1, and a 1GiB maxmem limit.\nconst arg1 = argon2id('password', 'saltsalt');\n```\n\n> [!WARNING]\n> Argon2 can't be fast in JS, because there is no fast Uint64Array.\n> It is suggested to use [Scrypt](#scrypt) instead.\n> Being 5x slower than native code means brute-forcing attackers have bigger advantage.\n\n#### eskdf\n\n```ts\nimport { eskdf } from '@noble/hashes/eskdf.js';\nconst kdf = await eskdf('example-university', 'beginning-new-example');\nconsole.log(kdf.fingerprint);\nconst key = kdf.deriveChildKey('aes', 0);\nkdf.expire();\n```\n\nExperimental KDF for deriving application-specific child keys from a username + password pair,\nbuilt on scrypt, pbkdf2 and hkdf with fixed work factors.\nNon-standard: prefer [scrypt](#scrypt) or [argon2](#argon2) for new designs.\n\n#### webcrypto: friendly wrapper\n\n```js\nimport { sha256, sha384, sha512, hmac, hkdf, pbkdf2 } from '@noble/hashes/webcrypto.js';\nimport { randomBytes } from '@noble/hashes/utils.js';\nconst whash = await sha256(Uint8Array.from([0xca, 0xfe, 0x01, 0x23]));\n\nconst key = new Uint8Array(32).fill(1);\nconst msg = new Uint8Array(32).fill(2);\nconst wmac = await hmac(sha256, key, msg);\n\nconst inputKey = randomBytes(32);\nconst salt = randomBytes(32);\nconst info = new TextEncoder().encode('application-key');\nconst hk1 = await hkdf(sha256, inputKey, salt, info, 32);\n\nconst pbkey1 = await pbkdf2(sha256, 'password', 'salt', { c: 524288, dkLen: 32 });\n```\n\nA thin wrapper over built-in `crypto.subtle`, mirroring the noble-hashes API and validating\ninputs, in just 30+ lines of code. Webcrypto methods are always async.\n\n#### utils\n\n```typescript\nimport { bytesToHex as toHex, randomBytes } from '@noble/hashes/utils.js';\nconsole.log(toHex(randomBytes(32)));\n```\n\n- `bytesToHex` will convert `Uint8Array` to a hex string\n- `randomBytes(bytes)` will produce cryptographically secure random `Uint8Array` of length `bytes`\n\n### Specs\n\n- SHA2: [RFC 6234](https://datatracker.ietf.org/doc/html/rfc6234)\n- SHA2-512/256: [pdf](https://eprint.iacr.org/2010/548.pdf)\n- SHA3: [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf)\n- SHA3-addons: [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf)\n- SHA3-addons KT128 (KangarooTwelve 🦘, K12) / TurboSHAKE: [RFC 9861](https://datatracker.ietf.org/doc/rfc9861/)\n- BLAKE1: [pdf](https://www.aumasson.jp/blake/blake.pdf)\n- BLAKE2: [RFC 7693](https://datatracker.ietf.org/doc/html/rfc7693)\n- BLAKE3: [site](https://blake3.io)\n- SHA1: [RFC 3174](https://datatracker.ietf.org/doc/html/rfc3174)\n- MD5: [RFC 1321](https://datatracker.ietf.org/doc/html/rfc1321)\n- RIPEMD160 (ISO/IEC 10118-3)\n- HMAC: [RFC 2104](https://datatracker.ietf.org/doc/html/rfc2104)\n- HKDF: [RFC 5869](https://datatracker.ietf.org/doc/html/rfc5869)\n- PBKDF2: [RFC 8018](https://datatracker.ietf.org/doc/html/rfc8018)\n- Scrypt: [RFC 7914](https://datatracker.ietf.org/doc/html/rfc7914)\n- Argon2: [RFC 9106](https://datatracker.ietf.org/doc/html/rfc9106)\n\n## Security\n\nThe library has been audited:\n\n- at version 1.0.0, in Jan 2022, independently, by [Cure53](https://cure53.de)\n  - PDFs: [website](https://cure53.de/pentest-report_hashing-libs.pdf), [in-repo](./audit/2022-01-05-cure53-audit-nbl2.pdf)\n  - Scope: everything, besides `blake3`, `sha3-addons`, `sha1` and `argon2`, which have not been audited\n  - The audit has been funded by [Ethereum Foundation](https://ethereum.org/en/) with help of [Nomic Labs](https://nomiclabs.io)\n\nWe've started regular AI-assisted self-audits in Apr 2026.\n\nIt is tested against official (ACVP / KAT) vectors, cross-library chained hashing,\nsliding-window length sweeps and property-based tests (fast-check),\nand is being fuzzed in CI.\n\nIf you see anything unusual: investigate and report.\n\n### Constant-timeness\n\nWe're targetting algorithmic constant time. _JIT-compiler_ and _Garbage Collector_ make \"constant time\"\nextremely hard to achieve [timing attack](https://en.wikipedia.org/wiki/Timing_attack) resistance\nin a scripting language. Which means _any other JS library can't have\nconstant-timeness_. Even statically typed Rust, a language without GC,\n[makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security)\nfor some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones.\nUse low-level libraries & languages.\n\n### Memory dumping\n\nThe library shares state buffers between hash function calls. Library-owned working buffers are\nzeroed after use, including mutable UTF-8 copies created from password-KDF string inputs.\nHowever, if an attacker can read application memory, you are doomed in any case:\n\n- JS strings are immutable and can't be overwritten with zeros — e.g. a password passed\n  to `scrypt(password, salt)` as a string stays in memory\n- Inputs & outputs are re-used across the application and stay in file buffers / memory anyway\n- `await anything()` writes all internal variables (including numbers) to memory, with no\n  guarantee of when they get overwritten — plenty of time for an attacker to read them\n\n### Supply chain security\n\n- **Commits** are signed with PGP keys to prevent forgery. Be sure to verify the commit signatures\n- **Releases** are made transparently through token-less GitHub CI and Trusted Publishing. Be sure to verify the [provenance logs](https://docs.npmjs.com/generating-provenance-statements) for authenticity.\n- **Rare releasing** is practiced to minimize the need for re-audits by end-users.\n- **Dependencies** are minimized, strictly pinned, and changes are checked with npm-diff.\n- **Dev dependencies** are excluded from end-user installs; they’re only used for development and build steps.\n\nFor this package, there are 0 dependencies; and a few dev dependencies:\n\n- jsbt contains helpers for building, benchmarking & testing secure JS apps. It is developed by the same author\n- prettier, fast-check and typescript are used for code quality / test generation / ts compilation\n\n### Randomness\n\nWe rely on the built-in\n[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues),\nwhich is considered a cryptographically secure PRNG.\n\nBrowsers have had weaknesses in the past - and could again - but implementing a userspace CSPRNG is even worse, as there’s no reliable userspace source of high-quality entropy.\n\n### Quantum computers\n\nCryptographically relevant quantum computer, if built, will allow to\nutilize Grover's algorithm to break hashes in 2^n/2 operations, instead of 2^n.\n\nThis means SHA256 should be replaced with SHA512, SHA3-256 with SHA3-512, SHAKE128 with SHAKE256 etc.\n\nAustralian ASD prohibits SHA256 and similar hashes [after 2030](https://www.cyber.gov.au/resources-business-and-government/essential-cyber-security/ism/cyber-security-guidelines/guidelines-cryptography).\n\n## Upgrading\n\nSupported node.js versions:\n\n- v2: v20.19+ (ESM-only)\n- v1: v14.21+ (ESM & CJS)\n\nv2.0 changelog:\n\n- The package is now ESM-only. ESM can finally be loaded from common.js on node v20.19+\n- `.js` extension must be used for all modules\n    - Old: `@noble/hashes/sha3`\n    - New: `@noble/hashes/sha3.js`\n    - This simplifies working in browsers natively without transpilers\n- Only allow Uint8Array as hash inputs, prohibit `string`\n    - Strict validation checks improve security\n    - To replicate previous behavior, use `utils.utf8ToBytes`\n- Rename / remove some modules for consistency. Previously, sha384 resided in sha512, which was weird\n    - `sha256`, `sha512` => `sha2.js` (consistent with `sha3.js`)\n    - `blake2b`, `blake2s` => `blake2.js` (consistent with `blake3.js`, `blake1.js`)\n    - `ripemd160`, `sha1`, `md5` => `legacy.js` (all low-security hashes are there)\n    - `_assert` => `utils.js`\n    - `crypto` internal module got removed: use built-in WebCrypto instead\n- Improve typescript types & option autocomplete\n- Bump compilation target from es2020 to es2022\n\n## Contributing & testing\n\n`npm install && npm run build && npm test` will build the code and run tests.\n\nThere are **additional** slow suites: timing-based DoS tests `npm run test:dos`,\nmulti-hour large-input tests `npm run test:slow`, ACVP LDT vectors `npm run test:acvp`,\nand memory-intensive KDF tests `npm run test:ultra`. The 9–17GiB scrypt cases require an\nexplicitly provisioned machine and run separately with `npm run test:ultra:scrypt`.\n\n`test/misc` directory contains unrolled implementations (sha3, argon2) and misc helper scripts.\n\nSome hashes are outside of scope of the library:\n- [Pedersen in micro-zk-proofs](https://github.com/paulmillr/micro-zk-proofs/blob/1ed5ce1253583b2e540eef7f3477fb52bf5344ff/src/pedersen.ts)\n- [Poseidon in noble-curves](https://github.com/paulmillr/noble-curves/blob/3d124dd3ecec8b6634cc0b2ba1c183aded5304f9/src/abstract/poseidon.ts)\n- [Poly1305 & GHash in noble-ciphers](https://github.com/paulmillr/noble-ciphers)\n\nSee [paulmillr.com/noble](https://paulmillr.com/noble/) for useful resources, articles, documentation and demos related to the library.\n\n## Speed\n\n```sh\nnpm run benchmark\n```\n\nBenchmarks measured on Apple M4.\n\nThe library could be 3x faster by utilizing loop unrolling. It isn't used because\nunrolling a) would increase bundle size b) make lib un-readable c) current perf is \"fast enough\"\nfor most use-cases.\n\nIf you need truly exemplar performance, switch to [awasm-noble](https://github.com/paulmillr/awasm-noble),\nwhich does unrolling in an auditable way and allows to achieve 10GB/s BLAKE3.\n\n```\n# 32B\nsha256 438 ns\nsha512 1219 ns\nsha3_256 1853 ns\nsha3_512 1864 ns\nkt128 1380 ns\nkt256 1370 ns\nturboshake128 1191 ns\nblake256 1335 ns\nblake2b 2186 ns\nblake2s 1055 ns\nblake3 981 ns\nripemd160 563 ns\nmd5 449 ns\nsha1 507 ns\nhmac(sha256) 1955 ns\nhmac(sha512) 5126 ns\nkmac256 6653 ns\nblake3(key) 1120 ns\n\n# 1MB\nsha256 x 297 mib/sec\nsha512 x 130 mib/sec\nsha3_256 x 78.1 mib/sec\nsha3_512 x 41.9 mib/sec\nkt128 x 184 mib/sec\nkt256 x 147 mib/sec\nturboshake128 x 186 mib/sec\nblake256 x 56.7 mib/sec\nblake2b x 66.2 mib/sec\nblake2s x 62.9 mib/sec\nblake3 x 90 mib/sec\nripemd160 x 179 mib/sec\nmd5 x 275 mib/sec\nsha1 x 417 mib/sec\nhmac(sha256) x 290 mib/sec\nhmac(sha512) x 129 mib/sec\nkmac256 x 78.4 mib/sec\nblake3(key) x 90.5 mib/sec\n\n# KDF\nhkdf(sha256) x 249,100 ops/sec @ 4015 ns/op\nblake3(context) x 480,400 ops/sec @ 2081 ns/op\npbkdf2(sha256, c: 2 ** 18) x 5 ops/sec @ 199 ms/op\nscrypt(n: 2 ** 19, r: 8, p: 1) x 1 ops/sec @ 751 ms/op\nargon2id(t: 1, m: 128MB) x 3 ops/sec @ 276 ms/op\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2022 Paul Miller [(https://paulmillr.com)](https://paulmillr.com)\n\nSee LICENSE file.\n","publish_time":1787835762588,"_cnpm_publish_time":1787835762588,"dist-tags":{"latest":"2.4.0"}}