Skip to content

Digest

A cryptographic digest is the fixed-length output of a one-way hash function (SHA-256, SHA-1, MD5) applied to arbitrary input, used to verify integrity, sign data and identify content by content.

Definition

What it is

A hash function takes bytes of any length and returns a string of fixed length: 256 bits (32 bytes) for SHA-256, 128 bits (16 bytes) for MD5, 160 bits for SHA-1. The mapping is deterministic and one-way. You cannot reconstruct the input from the digest, but you can verify that a given input produces a given digest.

Cryptographic digests are distinct from "checksums" in the loose sense. A CRC32 catches transmission errors; a SHA-256 digest resists deliberate collision attacks. Use CRC for storage media, SHA-256 for security-critical integrity.

Why it matters

Every HTTPS certificate, every Git commit, every container image, every signed JWT relies on a digest. When you pull nginx@sha256:abc..., you are trusting a digest — not a version tag, not a filename. The digest is the only thing an attacker cannot forge without breaking cryptography.

Cryptographic vs non-cryptographic

Algorithm

Output bits

Status

Use

CRC32

32

Checksum only

Storage, network frames

MD5

128

Broken (collisions)

Non-security only

SHA-1

160

Deprecated (SHAttered, 2017)

Legacy only

SHA-256

256

Current standard

TLS, Git, containers, signatures

SHA-3

variable

Current alternative

Post-quantum prep

Where digests appear

graph LR
  F[Input bytes] --> H[Hash function]
  H --> D[Digest 256-bit]
  D --> I[Integrity check]
  D --> S[Digital signature]
  D --> A[Content address]
  D --> C[Cache key]
  style D fill:#E8F5E9

How to use digests well

Digests that hold

  1. Never compare with `==` in security code

    Use constant-time comparison (hash_equals in PHP, hmac.compare_digest in Python) to avoid timing side-channels.

  2. Pin by digest, not tag

    Container images, tarballs and packages should reference name@sha256:..., not name:latest.

  3. Prefer SHA-256

    MD5 and SHA-1 have known collision attacks. Never use them for security, signatures or integrity.

  4. Record the digest in the manifest

    Every artifact should carry its digest in the manifest so deploys can verify.

Common failures

Origin

The word "digest" comes from Latin digestus, past participle of digerere ("to divide, to distribute"). In 1979 Ralph Merkle used it for hash functions and hash trees (Merkle trees). The NIST series (FIPS 180, then 180-4) standardized SHA-1 and SHA-2 in 1993–2015. SHA-3 followed in 2015 as a backup.

A cryptographic hash function is a mathematical algorithm that maps data of arbitrary size to a bit array of a fixed size.

— NIST FIPS 180-4, 2015 (paraphrase)
1979 · Merkle describe hash trees
1993 · SHA-1 estandarizado (FIPS 180)
2001 · SHA-2 (FIPS 180-2)
2017 · SHAttered (colisión SHA-1)
2015 · SHA-3 (FIPS 202)

Evidence

FAQ

Hash vs digest?

Same thing. "Digest" emphasizes the output; "hash" emphasizes the function.

Can a digest be reversed?

No, by design. Brute-force on weak inputs is possible; use strong hashing plus salt for passwords.

Is SHA-256 quantum-safe?

Not fully, but Grover's algorithm halves its effective strength to 128 bits, still acceptable in 2026.

MD5 vs SHA-256?

MD5 is faster and broken; SHA-256 is fast enough and collision-resistant.

Connections

Etymology

Origin: borrowed

  • digest (noun): from Latin digestus, "divided, ordered"

Semantic network

DigestcryptograpshaHashhmacSignatureContainer

● broader ● narrower ● related

Broader

  • cryptography

Related

Used in the garden

Sources