Athena Wiki

Cryptographic Hashing

cryptobeginner

Index of hashing pages - hash functions, length extension attacks, and hash cracking.

cryptohashingmd5sha1sha256length-extensioncrackingindex

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

PageDifficultyKey Technique
Hash FunctionsBeginnerUnderstand MD5/SHA, magic hashes
Length Extension AttackIntermediateForge MAC without knowing secret
Hash CrackingBeginnerhashcat, 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 - MD5
  • hashcat -m 100 hash.txt rockyou.txt - SHA-1
  • hashcat -m 1400 hash.txt rockyou.txt - SHA-256

MAC=H(secretmessage)\mathrm{MAC} = H(\mathrm{secret} \,\|\, \mathrm{message}) - 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 0e and only digits (parsed as scientific notation → 0).
  • Example: md5("240610708") begins with 0e462097… → loose == can match other 0e… 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 H(secretmsg)H(\mathrm{secret} \,\|\, \mathrm{msg}).

Hash length reference

FingerprintLikely algorithm
32 hex charsMD5
40 hex charsSHA-1
56 hex charsSHA-224
64 hex charsSHA-256
96 hex charsSHA-384
128 hex charsSHA-512
$2y$10$… (~60)bcrypt
$6$…SHA-512 crypt
$1$…MD5 crypt

Last updated on

On this page