Hello, this is Uncle Crypto, the NodeCrypto maintainer. For this first post I picked hashes. We will look at what a hash is, then go through the hash algorithms NodeCrypto provides, and later compute a few representative ones by hand.
Building a hash calculator as a workflow
Below is a workflow that converts the text "Hello NodeCrypto!" to bytes, feeds it to each of the following hash functions, and lets you check the results.
- SHA-256
- SHA-384
- SHA-512
Press the "Open in app" button below to run it yourself!

sha2-calculator.ncw Open in app Download .ncw
What is a hash?
A hash is a function that takes data of any length and turns it into a value of a fixed length. Whether the input is the single letter a or a 4.7 GB movie, SHA-256 always returns 32 bytes (64 hexadecimal digits). The result is called a digest, or simply the hash value, and it is often described as a "fingerprint" of the data.

Basic properties of a hash function
Unlike the hash functions used in hash tables, a cryptographic hash function must satisfy the following.
- Deterministic: the same input gives the same output, anywhere and any time.
- Fixed-length output: the output length does not depend on the input size.
- Fast: even a large input is digested quickly.
- One-way: you cannot recover the input from the digest. Unlike encryption, there is no such thing as decryption.
- Avalanche effect: flipping a single input bit changes about half of the output bits at random.
The avalanche effect is easier to see than to describe. Below are the SHA-256 digests of abc and abd. Only the last letter changed from c to d, yet 122 of the 256 bits (about 48%) are different.

Because of this, a digest tells you nothing about how similar two inputs are. It only tells you whether they are exactly the same. That is precisely why hashes are used to check data integrity.
Three resistances of a secure hash
For an n-bit hash function H to be called secure, three kinds of attack must be infeasible in practice.

- Preimage resistance: given a hash value y, it is hard to find an x with H(x) = y. Brute force costs about 2ⁿ computations.
- Second preimage resistance: given an input x, it is hard to find a different x' with H(x') = H(x). Also about 2ⁿ.
- Collision resistance: it is hard to find any two inputs with H(x) = H(x'). Because of the birthday paradox, about 2ⁿ/² computations give a real chance, so this is the first of the three to fall.
That is why the security strength of a hash is usually quoted by collision resistance. SHA-256 has a 256-bit output, so about 128 bits of collision resistance. For MD5 (128-bit output, 64 bits in theory) and SHA-1 (160-bit output, 80 bits in theory), methods were found that make collisions with far less work than that. Practical MD5 collisions were published in 2004, and in 2017 researchers at Google and CWI produced two different PDF files with the same SHA-1. This is why neither should be used for signatures or authentication today.
Where are hashes used?
- File integrity: if the SHA-256 of a downloaded file equals the value published by the distributor, the file was not corrupted or tampered with in transit. The checksum printed next to an installer is exactly this.
- Digital signatures: instead of signing a large document directly, you hash it and sign the hash. RSA, ECDSA and EdDSA all work this way.
- Message authentication (HMAC): mixing a secret key into a hash gives a tag that only key holders can produce (RFC 2104). The NodeCrypto HMAC node lets you choose the hash algorithm.
- Key derivation (KDF): HKDF and PBKDF2 call a hash (or HMAC) repeatedly inside to derive keys.
- Blockchains and Merkle trees: blocks and transactions are chained by their hashes so tampering can be detected. Bitcoin uses SHA-256 and RIPEMD-160; Ethereum uses Keccak-256.
- Deduplication and identifiers: files with the same content have the same hash, which is used for content addressing and finding duplicate files.
Warning: do not store passwords with a single pass of a fast hash such as SHA-256. Fast means an attacker can try billions of guesses per second. For passwords use a purpose-built function that is deliberately slow and salted, such as PBKDF2, scrypt or Argon2.
Hash algorithms in NodeCrypto
The NodeCrypto Cryptographic Hash node (hash-digest) takes an input Data (bytes) and outputs a Digest (bytes). You pick the Hash Algorithm property from a list of 20 algorithms. The figure below groups them by family.

SHA-2 family (NIST FIPS 180-4)
The most widely used standard family. TLS certificates, code signing, Bitcoin and most signature schemes rely on SHA-2.
| Algorithm | Output | Notes |
|---|---|---|
| SHA-224 | 28 bytes | A truncated variant of SHA-256 (different initial values) |
| SHA-256 | 32 bytes | The sensible default. NodeCrypto's default choice |
| SHA-384 | 48 bytes | Based on SHA-512. 192-bit collision resistance |
| SHA-512 | 64 bytes | Can be faster than SHA-256 on 64-bit CPUs |
| SHA-512/224 | 28 bytes | Short-output version of SHA-512 with its own initial values |
| SHA-512/256 | 32 bytes | Same idea. Resistant to length extension |
SHA-2 uses the Merkle–Damgård construction, which allows a length extension attack: knowing a hash value and the message length, one can compute the hash of the message with extra data appended, without knowing any secret. SHA-256 and SHA-512 are affected, so never use H(secret ∥ message) directly for authentication. Use HMAC. Truncated variants such as SHA-384 and SHA-512/256 only output part of the internal state, so the attack does not work on them.
SHA-3 family (NIST FIPS 202)
Standardized in 2015, SHA-3 is designed completely differently from SHA-2. Inside is a sponge construction using the Keccak permutation. It is an insurance policy in case SHA-2 weakens, so you choose it when you want a different family rather than for speed.
| Algorithm | Output | Notes |
|---|---|---|
| SHA3-224, SHA3-256, SHA3-384, SHA3-512 | 28, 32, 48, 64 bytes | Same lengths as SHA-2. Immune to length extension |
| SHAKE128 | 32 bytes by default | An XOF: the output length can be extended |
| SHAKE256 | 64 bytes by default | Same, with higher security strength |
An XOF (Extendable-Output Function) is a hash with no fixed output length. Ask for a short output when you need a 128-bit key, a long one when you need a 1 KB mask. The beginning of a long output equals the short output (prefix consistency). Modern post-quantum schemes such as ML-KEM and ML-DSA use SHAKE heavily inside.
Keccak-256 and Keccak-512
Keccak, the original of SHA-3, had one byte of padding changed during standardization. As a result, SHA3-256 and Keccak-256 give different values for the same input. Ethereum adopted Keccak-256 as it was before the standard was final, so to compute Ethereum addresses or function selectors you must pick Keccak-256, not SHA3-256. Feeding abc shows the difference immediately.
SHA3-256("abc") = 3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532
Keccak-256("abc") = 4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45
BLAKE family
A line of improvements on BLAKE, a finalist of the SHA-3 competition. They are not FIPS standards, but they are fast and simple and widely used.
- BLAKE2b (64 bytes by default): optimized for 64-bit platforms. RFC 7693. Aimed to be faster than MD5 with SHA-3-level security, and it is also the inner hash of Argon2.
- BLAKE2s (32 bytes by default): its sibling for 8- to 32-bit platforms.
- BLAKE3 (32 bytes by default): the newest, from 2020. It splits the input into chunks and processes them in parallel as a tree, so it is dramatically faster on large files. The output length can be extended like an XOF. It is not a NIST standard yet, so where compliance matters use SHA-2 or SHA-3.
Legacy: RIPEMD-160, SHA-1, MD5
| Algorithm | Output | Status today |
|---|---|---|
| RIPEMD-160 | 20 bytes | No practical collision yet. Used for compatibility, e.g. Bitcoin addresses (SHA-256 followed by RIPEMD-160) |
| SHA-1 | 20 bytes | A real collision was produced in 2017. Retired for signatures. Only compatibility uses remain, such as Git object names |
| MD5 | 16 bytes | Collisions can be generated in seconds on a laptop. Never use for signatures or authentication; only to match old checksums |
NodeCrypto keeps them because there is real work that requires matching values from existing systems. If an old download page lists only an MD5 checksum, you need a tool to check it. Just remember that such use catches transmission errors rather than preventing tampering.
Which one should I choose?
| Situation | Recommendation |
|---|---|
| No special reason | SHA-256 |
| Large data on a 64-bit server / higher security strength | SHA-512, SHA-384 |
| Avoid length extension by design / need a family other than SHA-2 | SHA3-256, SHA3-512 |
| Need to choose the output length | SHAKE128/256, BLAKE3 |
| Speed matters most (no standard required) | BLAKE3, BLAKE2b |
| Ethereum compatibility | Keccak-256 |
| Matching existing values | MD5, SHA-1, RIPEMD-160 (never for security) |
Same input, different algorithms
Feeding the single input abc to several algorithms shows how output length and shape differ. These are the same values the NodeCrypto hash node produces.
| Algorithm | Digest of abc (hex) |
|---|---|
| MD5 | 900150983cd24fb0d6963f7d28e17f72 |
| SHA-1 | a9993e364706816aba3e25717850c26c9cd0d89d |
| SHA-256 | ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad |
| SHA3-256 | 3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532 |
| BLAKE3 | 6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85 |
These match the published test vectors from FIPS 180-4, FIPS 202 and others, so you can compare them with results from other tools to check that an implementation is correct. The SHA-256 of the empty input (e3b0c442…b855) is another well-known value for checking.
Disclaimer: this post is for learning. Before applying cryptography in a real service, consult standards such as RFCs and NIST publications and have an expert review it.