Hashing
Summary
PDF p.54A cryptographic hashing algorithm generates a fixed-length string of bits (hash or message digest) from input plaintext of any length. Hashing ensures data integrity by making it impossible to recover the original data from the hash and minimizing the likelihood of different inputs producing the same output (collision). Popular hash algorithms include SHA (Secure Hash Algorithm) and MD5 (Message Digest Algorithm #5).
In plain words
Supplementary — not from your PDFA hash function turns any data into a short fixed-length fingerprint. You can't turn the fingerprint back into the data, and even a tiny change gives a completely different result, which makes hashes perfect for integrity checks.
Detailed explanation
PDF p.54-
Hashing Algorithm
- Definition: Produces a fixed-length string of bits from input plaintext.
- Properties: One-way function (impossible to recover plaintext) and collision-resistant (unlikely for different inputs to produce the same output).
-
Integrity Verification
-
Password Comparison
- Bob has a digest of Alice's plaintext password.
- Alice hashes her password and sends the digest to Bob.
- Bob compares the received digest with the stored hash to verify the password.
-
File Integrity
- Alice hashes a file (e.g., setup.exe) and publishes the digest.
- Bob downloads the file and the digest.
- Bob hashes the downloaded file and compares it with the published digest to ensure integrity.
- If Mallory substitutes the file, the hash comparison will fail, indicating tampering.
-
Password Comparison
-
Popular Hash Algorithms
-
Secure Hash Algorithm (SHA)
- Considered the strongest algorithm.
- Variants produce different-sized outputs (e.g., SHA256 produces a 256-bit digest).
-
Message Digest Algorithm #5 (MD5)
- Produces a 128-bit digest.
- Less secure than SHA256 but may be required for compatibility.
-
Secure Hash Algorithm (SHA)
Important terms
taken from the text above- Hashing Algorithm
- Produces a fixed-length string of bits from input plaintext.
Examples & real-world scenarios
Supplementary — not from your PDF- Comparing a download's SHA-256 with the value the publisher lists.
- Storing password hashes instead of passwords.
- MD5 gives 128-bit hashes; SHA-256 gives 256-bit hashes.
Scenario
A company distributes a firmware update and publishes its hash on a separate HTTPS page. Technicians hash the file before installing it, so a tampered copy is caught before it reaches any device.
Common mistakes
Supplementary — not from your PDF- Calling hashing 'encryption'. It can't be decrypted.
- Using MD5 for anything security-sensitive when a SHA-2 option exists.
Practical skills
Supplementary — not from your PDF- Verify a file's integrity with a hash.
What I should remember
Key Points PDF p.54-
Hashing Algorithm
- Fixed-Length Output: From any length of input.
- One-Way Function: Impossible to recover plaintext.
- Collision-Resistant: Different inputs unlikely to produce the same output.
-
Integrity Verification
- Password Comparison: Hashes compared to verify passwords.
- File Integrity: Hashes compared to verify file integrity.
-
Popular Hash Algorithms
- SHA: Strong, with variants like SHA256 (256-bit digest).
- MD5: 128-bit digest, less secure but sometimes necessary for compatibility.