Lesson 2.1: Hash functions
What a cryptographic hash function guarantees: the same input always gives the same fixed-size output, a tiny change gives a completely different output (the avalanche effect), and it's infeasible to go back or to find two inputs with the same hash. Which hashes are still safe (SHA-256, SHA-3, BLAKE2) and which are broken (MD5, SHA-1) and why that matters. In the lab you hash short and long inputs with sha256sum, change one letter and compare, and see the output lengths of MD5, SHA-1 and SHA-256.
15 min
You will learn to
- List the properties of a cryptographic hash
- Demonstrate the avalanche effect
- Use sha256sum, sha1sum and md5sum
- Explain collisions and why MD5 and SHA-1 are broken
- Choose a hash for integrity checks
Key terms
- Cryptographic hash function
- A function that maps any input to a fixed-size output so that it's infeasible to reverse, to find another input with the same output, or to find any two inputs with the same output.
- Digest
- The output of a hash function.
- Avalanche effect
- A tiny change in input changes about half the output bits.
- Collision
- Two different inputs with the same hash.
- SHA-2 and SHA-3
- Families of hash functions standardised by NIST (FIPS 180-4 and FIPS 202). SHA-256 is the most widely used member of SHA-2.
← The OWASP Top 10, and what attacks look like in a log · All lessons · Assets, threats, vulnerabilities and risk →