createHash()
The node:crypto function that creates a hash object: feed it data with update() and get the result with digest().
In more detail
For example createHash("sha256").update(data).digest("hex") returns a SHA-256 hash as hex. crypto.hash() is a shorter one-call version in recent Node.js.
Related terms
- hash — A short fixed-length fingerprint calculated from data, which changes completely if even one byte of the data changes.
- SHA-256 — A widely used hash function that turns any data into a 256-bit fingerprint, shown as 64 hexadecimal characters.
- node:crypto — The built-in Node.js module for hashing, HMACs, encryption, random numbers and key derivation, backed by OpenSSL.
Taught in
- Cryptographic Primitives: node:crypto & Ciphers — Node.js Internals & Backend Services
- Native WebSockets: Bidirectional Real-Time Streams — Node.js Internals & Backend Services