Cryptographic Hashing
Index of hashing pages - hash functions, length extension attacks, and hash cracking.
Cryptographic Hashing
Cryptographic hashing is a one-way mathematical function that deterministically maps arbitrary-length inputs to fixed-size outputs (fingerprints), designed to be irreversible and collision-resistant. How it works: Hash functions process input in blocks with non-linear operations (mixing, rotation, addition); identical inputs always produce identical outputs; reversing a hash requires brute-forcing the input space since no algebraic inverse exists. Why it matters: Used for password storage, data integrity verification, and digital signatures; exploitable through weak algorithms (MD5, SHA-1 collisions), unsalted storage, or length extension attacks; CTF challenges often combine hashing vulnerabilities with weak randomness or predictable inputs.
Pages in This Subsection
| Page | Difficulty | Key Technique |
|---|---|---|
| Hash Functions | Beginner | Understand MD5/SHA, magic hashes |
| Length Extension Attack | Intermediate | Forge MAC without knowing secret |
| Hash Cracking | Beginner | hashcat, john, online databases |
Quick selection guide
Given a hash, recover the plaintext
- Try CrackStation first (instant if the password is in a database).
hashcat -m 0 hash.txt rockyou.txt- MD5hashcat -m 100 hash.txt rockyou.txt- SHA-1hashcat -m 1400 hash.txt rockyou.txt- SHA-256
- forge without the secret
- Length extension (MD5, SHA-1, SHA-256 Merkle–Damgård):
hashpumpy,hash_extender. - HMAC - not vulnerable to length extension in the same way.
PHP == and “magic” hashes
- Try values whose hex digest starts with
0eand only digits (parsed as scientific notation →0). - Example:
md5("240610708")begins with0e462097…→ loose==can match other0e…digests.
Need an MD5 collision (not a preimage)
- Use known collision generators / precomputed pairs (e.g. research tooling such as cr.yp.to collision demos).
Is it HMAC?
- If the challenge uses proper HMAC, assume no raw length-extension forgery on .
Hash length reference
| Fingerprint | Likely algorithm |
|---|---|
| 32 hex chars | MD5 |
| 40 hex chars | SHA-1 |
| 56 hex chars | SHA-224 |
| 64 hex chars | SHA-256 |
| 96 hex chars | SHA-384 |
| 128 hex chars | SHA-512 |
$2y$10$… (~60) | bcrypt |
$6$… | SHA-512 crypt |
$1$… | MD5 crypt |
Last updated on