Practical overview
When it fits
Use it when a JavaScript or TypeScript application needs specific Ethereum-related cryptographic operations and its runtime fits the documented support. Import the relevant submodule rather than relying on a single package-wide entry point.
Who it is for
- JavaScript and TypeScript developers building Ethereum-related applications.
- Teams that need selected cryptographic primitives in browser or Node.js code.
Documented uses
- Hash byte data using functions such as SHA-256 or Keccak.
- Derive keys with PBKDF2 or scrypt.
- Generate secure random data or perform secp256k1 public-key, signing and verification operations.
- Use documented encryption, HD-key and mnemonic modules in application code.
Requirements & limits
The package is open source under the MIT license and is installed through npm.
- The README explicitly supports major browsers and Node.js on x86 and arm64; support for other major runtimes and platforms is best-effort.
- The library has separate submodules for primitives rather than one entry point.
- The package re-exports six noble and scure dependencies and recommends pinning the package version in consuming applications.
- Synchronous PBKDF2 and scrypt can block a browser’s main thread; asynchronous functions are also documented.
- The AES documentation says not to use a password directly as an AES key and recommends deriving a strong key.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install the library and select a cryptographic module
Add the package to a JavaScript or TypeScript project and import a specific primitive.
Before you start
- A JavaScript or TypeScript project using npm.
Steps
Install the package with the command below.
npm install ethereum-cryptographyImport the needed function from its documented submodule, such as
sha256fromethereum-cryptography/sha256.js.Pass the documented input type, such as a
Uint8Array; use the utilities submodule to convert strings to bytes when needed.
Expected outcome
The application can call the selected cryptographic primitive without importing a single all-in-one entry point.
Guide limitations
- Major browsers and Node.js on x86 and arm64 are explicitly supported; other runtimes and platforms are best-effort.
- For browser use with Rollup, the README specifies CommonJS and node-resolve plugins and a browser-oriented resolution configuration.
Derive a key asynchronously with PBKDF2
Use the documented PBKDF2 module to derive key bytes from a password and salt.
Before you start
- The installed
ethereum-cryptographypackage. - Password and salt represented as
Uint8Arrayvalues, or converted to bytes with the utilities module.
Steps
Import
pbkdf2fromethereum-cryptography/pbkdf2.jsandutf8ToBytesfromethereum-cryptography/utils.js.Convert the password and salt to byte arrays if they are strings.
Call the asynchronous function with the password bytes, salt bytes, iteration count, output length and digest; the README example uses 131072 iterations, 32 output bytes and SHA-256.
Expected outcome
PBKDF2 returns derived key bytes for the application to use.
Guide limitations
- The README describes PBKDF2 as very slow and advises against its synchronous variant in browsers because it can block the main thread.
- The documentation cautions that password encoding is a frequent source of errors and directs users to review its encoding notes.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 9 October 2026
- Original website title
- ethereum/js-ethereum-cryptography · Official homepage title · retained in its source language

