Cryptographic hash function (SHA-256)
A function that turns any data into a short fixed-size fingerprint that is practically impossible to reverse or to match with different data.
A cryptographic hash function such as SHA-256 (FIPS 180-4) maps any input to a fixed-size digest. The same input always gives the same digest, a tiny change gives a completely different one, and nobody can practically find the input from the digest or two inputs with the same digest (a collision).
That makes it a fingerprint: download checksums, package lockfiles and SBOMs pin exact file contents, Git names every object by its hash, and Merkle trees stack hashes to vouch for whole datasets. Older functions break over time: practical collisions have been shown for MD5 and for SHA-1, so they should not protect anything new.
Passwords are a special case. A fast hash is the wrong tool there, because attackers can try billions of guesses; use a deliberately slow password hash such as Argon2id or bcrypt, as the OWASP Password Storage Cheat Sheet recommends. The hashes inside a hash table are a different, non-cryptographic kind, built for speed.
Sources
- NIST: FIPS 180-4, Secure Hash Standard (SHS) csrc.nist.gov
- SHAttered: the first SHA-1 collision shattered.io
- OWASP: Password Storage Cheat Sheet cheatsheetseries.owasp.org
Related terms
- Merkle tree: A tree of hashes where each parent hashes its children, so one root hash vouches for a whole dataset and any item can be proven with a few hashes.
- Hash table: A structure that finds a value by its key in about constant time by hashing the key into a slot; fast lookups, no order.
- SBOM (software bill of materials): A machine-readable list of every component and version inside a piece of software, like an ingredients label.
- Software supply chain attack: Compromising software through what it is built from: a package, a build tool, a CI action or a maintainer’s account.
- Bloom filter: A tiny bit array that answers “definitely not in the set” or “probably in the set”, used to skip expensive lookups.
