A hash value, also called a digest, is the fixed-length output of a cryptographic hash function. The function can take data of any size, but it works one way: the original data cannot be recovered from the hash. Unlike encryption, hashing uses no key and does not keep data confidential. section 14.2.4
Checking a download
A website publishes a file’s SHA-256 hash. After downloading the file, you use a hashing tool to calculate its hash and compare the two values. A match helps confirm that the file was not changed or corrupted during transfer. section 14.2.4
Hash values also help protect stored passwords. A system stores a password’s digest rather than the plaintext password, then hashes a login attempt to check for a match. This does not make a weak password safe: someone with the stored digest can hash likely guesses and look for a match. Salting helps defend against precomputed rainbow-table attacks. section 12.3.3
|
USE
|
PUROPOSE
|
SCENARIO
|
|
Message
|
Verifying
message integrity during transmission.
|
Alice sends a
message to Bob with a hash. Bob calculates the hash of the received message
to ensure it matches.
|
|
Files
|
Verifying file
integrity, especially during transfers.
|
A software
file is downloaded with its hash. The user checks the hash after download to
ensure the file wasn’t altered.
|
|
Records
|
Ensuring
integrity of records in databases or logs.
|
A database
record (e.g., customer info) is hashed. If the record is changed, the new
hash will not match the original.
|
Compare how the same hash-checking idea applies to messages in transit, downloaded files, and database or log records. section 14.2.4
A matching hash checks for changes, but hashing alone does not establish who sent a document. A digital signature combines its hash with asymmetric encryption so a recipient can check both the document’s integrity and the signature. section 14.2.4 section 14.2.5








