digest
The short, fixed-size output of a hash function, which acts as a fingerprint of the input data.
In more detail
Any change to the input, even one character, produces a completely different digest, so comparing digests shows whether data has changed. A SHA-256 digest is always 32 bytes, shown as 64 hexadecimal characters, whether the input is a password or a ten-megabyte file. A digest proves integrity only if the expected value came from somewhere an attacker cannot alter, such as a signed release page or an offline manifest.
Examples
sha256sum changes.csv sample.txt results.csv > manifest.sha256return hashlib.file_digest(f, "sha256").hexdigest()ten megabytes in, 32 bytes outRelated 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.
- checksum — A small value calculated from data and stored or sent with it, so the data can later be checked for accidental errors.
- manifest.json — A file written at backup time that lists every backed-up file with its SHA-256 digest, so a restore can be checked byte for byte.
Taught in
- Cryptographic Hashing: SHA-256, SHA-3 & Passwords — Cybersecurity Fundamentals, GRC & Cryptography
- Backup Architectures: 3-2-1, Immutability & Air-Gaps — Cybersecurity Fundamentals, GRC & Cryptography