A cryptographic hash function turns input of any size into a fixed-length value called a hash or message digest. Hashing is one-way: the original data cannot be recovered from the digest, and no key is used. section 14.2.4
A hash helps check integrity, not confidentiality. If data changes, its newly calculated hash will differ. Encryption can protect data’s confidentiality while hashing helps check whether it was altered. section 14.2.4
Checking a file
A website provides a SHA-256 checksum with a download. After downloading the file, calculate its hash with a hashing tool and compare it with the published value. A match indicates the file was not altered or corrupted during transmission. section 14.2.4
Hash comparisons can help check integrity in several settings:
- Messages: the recipient hashes the received message and compares the result with the supplied digest. section 14.2.4
- Database records and logs: a changed record or log can produce a hash that no longer matches, alerting analysts to possible tampering. section 12.6.3 section 14.2.4
Hash algorithms differ. MD5 is a legacy option and is not recommended for security; SHA-1 is deprecated because of collision attacks. SHA-2 includes SHA-256 and SHA-512, while SHA-3 is described as an alternative to SHA-2. section 14.2.4
Figure 14.3 Illustration of Alice sending a message to Bob using hashing to ensure integrity

Illustrates a sender sharing a message digest so a recipient can check the message’s integrity. section 14.2.4





