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 runsStatusExport coverageDetails
nstd✅ worksNative tests match Node.js: digest.
Browser❔ not tested100% of Node.jsIt imports with the small process shim. 74/74 Node.js exports are available. No module-specific behavior test ran.
Node.js (host)✅ works100% of Node.js74/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
ExportNode.jsnstdlibbrowser
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