Encoding vs Encryption vs Hashing: The Difference Every CTF Player Needs

Article · General

Beginners often call everything "encrypted" — base64 strings, MD5 hashes, AES ciphertext. They're three different things with three different ways to get the original back (or not). Telling them apart is often the entire first step of a crypto challenge.

Encoding: changing the format, no secret involved

Encoding turns data into another representation so it can be stored or transmitted safely: base64, hex, URL encoding, binary, Morse. There is no key. Anyone who recognizes the scheme can reverse it with one command:

echo 'cGljb0NURg==' | base64 -d
echo '7069636f' | xxd -r -p

How to recognize it: a restricted alphabet (base64: A-Z a-z 0-9 + / with = padding; hex: 0-9 a-f) and output length proportional to the input. How to attack it: decode it. CyberChef's Magic operation will often identify it for you.

Encryption: reversible, but only with a key

Encryption is designed so that only someone with the key can recover the plaintext: AES, RSA, and classic ciphers like Caesar or Vigenère. Without the key, modern encryption is not reversible in practice.

How to recognize it: random-looking bytes (often shown as base64 or hex on top), lengths in multiples of a block size (16 bytes for AES), or, for classic ciphers, text that keeps its spacing and punctuation. How to attack it: CTF challenges never expect you to break AES itself. Look for the weakness: a key in the source, a reused nonce, a tiny RSA modulus, a short XOR key, or a classic cipher that falls to frequency analysis. See common weak ciphers in crypto CTFs.

Hashing: one-way, fixed length

A hash function maps any input to a fixed-length digest: MD5 (32 hex chars), SHA-1 (40), SHA-256 (64). It's deliberately one-way — there is no "unhash". The same input always gives the same output, which is how passwords are checked without storing them.

How to recognize it: a fixed length regardless of input, hex characters only, or a format like $2b$12$... (bcrypt) or $6$... (sha512crypt). How to attack it: guess inputs and compare. Wordlists and rules with John the Ripper or hashcat, or a lookup in an online database of precomputed hashes for common values.

A quick decision table

Layers are common

Challenges love to stack them: AES ciphertext encoded as base64, a hash written in hex, a flag encoded three times over. Peel one layer at a time and ask the same question at each step: does this need a key, is it one-way, or is it just a different format?

← Back to Blog