Skip to main content

Module crypto

Module crypto 

Source
Expand description

Node crypto module.

  • createHash(algo) → a Hash instance (update(...).digest(enc)), backed by the md-5/sha1/sha2 crates.
  • createHmac(algo, key) → an Hmac instance (update(...).digest(enc)), backed by the hmac crate over the same digests.
  • randomBytes, randomUUID, randomInt — CSPRNG output via getrandom.

Hash/Hmac are plain objects tagged @@native = "Hash" / "Hmac" accumulating input in a hidden @@data byte array until digest finalizes.

Constants§

METHODS

Functions§

call
cipher_instance_call
Cipheriv/Decipheriv instance methods: update(data[,inEnc,outEnc]) and final([outEnc]). Input is accumulated in @@data; the transform runs at final (CBC needs the full block/padding stream, so update returns empty and final returns the whole result — the standard update()+final() concatenation is byte-identical to node).
construct_x509
new X509Certificate(pemOrDer) → an X509Certificate instance.
dh_instance_call
DiffieHellman instance dispatch.
ecdh_instance_call
ECDH instance dispatch.
hmac_instance_call
Hmac instance methods: update (chainable) and digest.
instance_call
Hash instance methods: update (chainable) and digest.
key_object_instance_call
KeyObject instance dispatch (export({type,format}), equals).
sign_verify_instance_call
Sign/Verify instance dispatch.
x509_instance_call
X509Certificate instance dispatch (toString, toLegacyObject).