0 / 16 flipped
What are the four properties of a cryptographic hash function?
1. Deterministic: same input = same output always. 2. One-way: cannot reverse to find input. 3. Avalanche effect: tiny input change = completely different hash. 4. Collision-resistant: cannot find two inputs with same hash.
What is the avalanche effect?
A tiny change in input (even one bit) produces a completely different output hash β roughly half of all output bits change. Ensures similar inputs produce completely different hashes, making pattern analysis useless.
Why is MD5 no longer secure?
Practical collision attacks were demonstrated in 2004 β two different files can be crafted to produce the same MD5 hash. An attacker could substitute a malicious file that passes MD5 verification. MD5 should not be used for any security-critical purpose.
What hash algorithm is the current standard for most security uses?
SHA-256 (part of the SHA-2 family). Produces a 256-bit (64 hex character) digest. No practical collisions found. Used for file verification, digital signatures, certificate fingerprints, TLS, and password hashing.
What is a salt in password hashing?
A random unique value added to a password before hashing. Stored alongside the hash (not secret). Ensures identical passwords produce different hash values. Defeats rainbow tables and precomputed attacks β each user's hash requires individual cracking.
What is a rainbow table attack?
An attack using precomputed tables of hashes for common passwords. Allows instant lookup of a stolen hash to find the original password. Defeated by salting β each unique salt requires its own precomputed table, making the attack computationally infeasible.
How do you create a digital signature?
1. Hash the document (e.g., SHA-256). 2. Encrypt the hash with YOUR OWN PRIVATE key. The result is the digital signature. Note: this is the opposite direction from encryption β you use your private key (not the recipient's public key).
How do you verify a digital signature?
1. Decrypt the signature using the sender's PUBLIC key β this reveals the sender's original hash. 2. Independently compute the hash of the received document. 3. Compare: if hashes match β authentic and unmodified. If they differ β tampered or forged.
What three properties do digital signatures provide?
1. Integrity β any document change breaks the signature (hash mismatch). 2. Authentication β only the holder of the private key could have created the signature. 3. Non-repudiation β the signer cannot deny signing; the private key is mathematically proof of identity.
What is non-repudiation?
The inability to deny having performed an action. A digital signature provides non-repudiation: only the private key holder could have created the signature. The signer cannot later claim they didn't sign the document. Legally significant in many jurisdictions.
Does hashing provide confidentiality?
No. Hashing provides integrity (proof of no modification), not confidentiality (keeping data secret). A hash does not conceal the original data. Anyone with the data can compute the same hash. Hashing is a one-way fingerprint, not encryption.
What is HMAC?
Hash-based Message Authentication Code β combines a hash function with a shared secret key. Provides both data integrity and authentication between parties sharing the key. Unlike digital signatures, uses symmetric key material β both parties must know the key. Used in TLS, API authentication, and VPNs.
What is code signing?
Applying a digital signature to software by the publisher. When the OS installs the software, it verifies the signature β confirming the code came from the claimed publisher and hasn't been modified. Prevents malware from masquerading as legitimate software updates.
What is file integrity monitoring (FIM)?
Continuously hashing critical files and comparing to known-good baseline hashes. If a file changes (malware modification, unauthorized config change), the hash changes and an alert fires. Used on servers where system files and configs should never change unexpectedly.
Why are bcrypt and Argon2 preferred over SHA-256 for password hashing?
bcrypt and Argon2 are intentionally slow (key stretching / key strengthening). A legitimate login takes ~200ms β acceptable. A brute-force attack trying millions of passwords per second is slowed to thousands or fewer. SHA-256 is fast β fast hashing enables fast brute-force attacks on stolen password databases.
What does a hash collision mean for security?
A collision means two different inputs produce the same hash. If an attacker can create a malicious file with the same hash as a trusted file, the integrity check passes but the file is different. This is why MD5 and SHA-1 are broken for security β practical collisions exist. SHA-256 has no known practical collisions.