node:crypto
#Import
import crypto from "nstdlib/crypto";Note
Its behavior matches Node.js. Details: randomness, timingSafeEqual and subtle run on the host WebCrypto. createHash/createHmac/hash() throw unless a host installs the digest bridge. Ciphers, keys and signing need OpenSSL and throw.
#Runtime support
| Where it runs | Status | Export coverage | Details |
|---|---|---|---|
| nstd | ✅ works | – | Native tests match Node.js: digest. |
| Browser | ❔ not tested | 100% of Node.js | It imports with the small process shim. 74/74 Node.js exports are available. No module-specific behavior test ran. |
| Node.js (host) | ✅ works | 100% of Node.js | 74/74 exports. |
#Exports (74 of 74)
Each cell shows what happens when code reads an export:
- ✅ Available through every import style. A named error also counts.
- ⚠️ Available through only some import styles.
- ❔ The export exists but has no value.
- ❌ The export does not exist.
- – This environment was not measured.
Show all 74 exports
| Export | Node.js | nstdlib | browser |
|---|---|---|---|
Certificate | ✅ | ✅ | ✅ |
Cipheriv | ✅ | ✅ | ✅ |
Decipheriv | ✅ | ✅ | ✅ |
DiffieHellman | ✅ | ✅ | ✅ |
DiffieHellmanGroup | ✅ | ✅ | ✅ |
ECDH | ✅ | ✅ | ✅ |
Hash | ✅ | ✅ | ✅ |
Hmac | ✅ | ✅ | ✅ |
KeyObject | ✅ | ✅ | ✅ |
Sign | ✅ | ✅ | ✅ |
Verify | ✅ | ✅ | ✅ |
X509Certificate | ✅ | ✅ | ✅ |
argon2 | ✅ | ✅ | ✅ |
argon2Sync | ✅ | ✅ | ✅ |
checkPrime | ✅ | ✅ | ✅ |
checkPrimeSync | ✅ | ✅ | ✅ |
constants | ✅ | ✅ | ✅ |
createCipheriv | ✅ | ✅ | ✅ |
createDecipheriv | ✅ | ✅ | ✅ |
createDiffieHellman | ✅ | ✅ | ✅ |
createDiffieHellmanGroup | ✅ | ✅ | ✅ |
createECDH | ✅ | ✅ | ✅ |
createHash | ✅ | ✅ | ✅ |
createHmac | ✅ | ✅ | ✅ |
createPrivateKey | ✅ | ✅ | ✅ |
createPublicKey | ✅ | ✅ | ✅ |
createSecretKey | ✅ | ✅ | ✅ |
createSign | ✅ | ✅ | ✅ |
createVerify | ✅ | ✅ | ✅ |
decapsulate | ✅ | ✅ | ✅ |
diffieHellman | ✅ | ✅ | ✅ |
encapsulate | ✅ | ✅ | ✅ |
fips | ✅ | ✅ | ✅ |
generateKey | ✅ | ✅ | ✅ |
generateKeyPair | ✅ | ✅ | ✅ |
generateKeyPairSync | ✅ | ✅ | ✅ |
generateKeySync | ✅ | ✅ | ✅ |
generatePrime | ✅ | ✅ | ✅ |
generatePrimeSync | ✅ | ✅ | ✅ |
getCipherInfo | ✅ | ✅ | ✅ |
getCiphers | ✅ | ✅ | ✅ |
getCurves | ✅ | ✅ | ✅ |
getDiffieHellman | ✅ | ✅ | ✅ |
getFips | ✅ | ✅ | ✅ |
getHashes | ✅ | ✅ | ✅ |
getRandomValues | ✅ | ✅ | ✅ |
hash | ✅ | ✅ | ✅ |
hkdf | ✅ | ✅ | ✅ |
hkdfSync | ✅ | ✅ | ✅ |
pbkdf2 | ✅ | ✅ | ✅ |
pbkdf2Sync | ✅ | ✅ | ✅ |
privateDecrypt | ✅ | ✅ | ✅ |
privateEncrypt | ✅ | ✅ | ✅ |
prng | ✅ | ✅ | ✅ |
pseudoRandomBytes | ✅ | ✅ | ✅ |
publicDecrypt | ✅ | ✅ | ✅ |
publicEncrypt | ✅ | ✅ | ✅ |
randomBytes | ✅ | ✅ | ✅ |
randomFill | ✅ | ✅ | ✅ |
randomFillSync | ✅ | ✅ | ✅ |
randomInt | ✅ | ✅ | ✅ |
randomUUID | ✅ | ✅ | ✅ |
randomUUIDv7 | ✅ | ✅ | ✅ |
rng | ✅ | ✅ | ✅ |
scrypt | ✅ | ✅ | ✅ |
scryptSync | ✅ | ✅ | ✅ |
secureHeapUsed | ✅ | ✅ | ✅ |
setEngine | ✅ | ✅ | ✅ |
setFips | ✅ | ✅ | ✅ |
sign | ✅ | ✅ | ✅ |
subtle | ✅ | ✅ | ✅ |
timingSafeEqual | ✅ | ✅ | ✅ |
verify | ✅ | ✅ | ✅ |
webcrypto | ✅ | ✅ | ✅ |