Lab · Crypto Playground
← All sessions
Flags
0 / 6
Hands-On Lab · Session 1 companion

Crypto Playground

The Session 1 quiz asks which mode leaks patterns. This lab lets you watch it happen — hash text and see the avalanche effect, encrypt an image in ECB until the picture bleeds through the ciphertext, break a Caesar cipher by letter frequency, generate the same Ed25519 keypair your SSH keys use, and solve six flags. Everything runs in your browser with the native WebCrypto API. Nothing is sent anywhere.
WebCrypto & hand-rolled AES
The ECB penguin, live
Ed25519 SSH keys
6 CTF flags
Hash Lab Encoding Bench Caesar Breaker AES-GCM Vault Ed25519 Keys ECB Penguin CTF Flags
#๏ธโƒฃ

Hash Lab

One-way functions & the avalanche effect
A cryptographic hash maps any input to a fixed-size digest, one-way and deterministically. Change a single bit of input and roughly half the output bits flip — the avalanche effect. Type below and watch MD5, SHA-1, SHA-256 and SHA-512 update live. MD5 and SHA-1 are shown as broken-by-example, not for real use.
H1
Live digestsEvery algorithm, recomputed on every keystroke.
H2
Avalanche visualiserTwo inputs one edit apart. Differing hex digits of the SHA-256 are highlighted.
A ยท sha256
B ยท sha256
๐Ÿ”

Encoding Bench

Encoding is not encryption
CTF challenges love to wrap a flag in layers of encoding — Base64, hex, ROT13, single-byte XOR. None of it is secret; anyone can reverse it. This bench chains transforms so you can peel layers off (or stack them on).
E1
Transform benchPick a direction and an operation; feed the output back into the input to chain.
โ€”
๐Ÿ”ค

Caesar Breaker

Frequency analysis, automated
Session 1 Q6โ€“Q7: a substitution cipher falls to frequency analysis given ~50 characters. A Caesar cipher is the simplest case — only 26 keys. This breaker scores all 26 shifts by χ² distance from English letter frequencies and ranks the most-likely plaintext first. No key needed.
C1
Auto-crack a Caesar cipherPaste ciphertext; the best-fitting shift floats to the top.
๐Ÿ”

AES-GCM Vault

Authenticated encryption, done right
This is the correct way (Session 1 Q11): AES-256 in GCM mode, with the key stretched from your passphrase via PBKDF2 (100k iterations, SHA-256). A random salt and IV are generated per message and shown to you — they are not secret, but must never repeat. GCM also authenticates: flip one bit of ciphertext and decryption refuses (Q12's lesson, enforced).
A1
Encrypt & decryptThe output blob packs salt ยท IV ยท ciphertext+tag, Base64-encoded. Paste it back to decrypt.
โ€”
๐Ÿ”‘

Ed25519 — the keys behind SSH

Signatures prove identity, they don't hide data
When you run ssh-keygen -t ed25519 -f ~/demo_key, this is the maths you get. Ed25519 is a public-key signature scheme, not encryption: the private key signs, the public key verifies. That is exactly how SSH proves who you are without ever sending a password — the server holds your public key, you prove you hold the matching private one. Generate a keypair below, sign a message, then tamper with it and watch verification fail. The public key even renders as a real SHA256: fingerprint, identical to what ssh-keygen -lf prints.

โš ๏ธ Always pass -f with a fresh filename. Bare ssh-keygen -t ed25519 targets the default ~/.ssh/id_ed25519 — if you already have one it prompts "Overwrite (y/n)?", and a reflexive y destroys your real key with no undo. This lab never touches your disk: the keypair below is generated in your browser and vanishes on reload.
K1
Generate a keypair & signThe private key never leaves this page. The signature is verifiable by anyone holding the public key — and by no one else.
๐Ÿง

The ECB Penguin

Watch a broken mode leak the picture
Session 1 Q10's famous example, made real. The same image is encrypted with the same AES key twice — once in ECB (each 16-byte block encrypted independently) and once in CTR (a proper keystream mode). WebCrypto refuses to expose ECB precisely because it is unsafe, so this runs a hand-rolled AES-128 (verified against the FIPS-197 vectors). In ECB, identical plaintext blocks → identical ciphertext blocks, so the penguin's flat regions survive. CTR looks like noise.
P1
Encrypt an image, two waysSame key, same plaintext. Only the mode differs.
plaintext
AES-ECB ยท leaks
AES-CTR ยท safe
๐Ÿšฉ

CTF Flags

6 challenges · use the tools above
Each challenge hides a flag of the form flag{...}. Solve it using the benches above, then submit. Your answer is hashed in your browser and compared to a stored SHA-256 — the plaintext flags are not in this file's source, so no peeking in view-source. Case- and whitespace-insensitive.
1 flag
Layer cakeThis Base64 decodes to text that still looks scrambled. What was done to it before Base64? (Encoding Bench.)
c3ludHt5bmxyZWZfYnNfcmFwYnF2YXR9
1 flag
A single byte of "encryption"This hex was XORed with one repeating byte. Find the key that makes it readable. (Encoding Bench โ†’ XOR, reverse.)
3c363b3d212235280533290534352e053f343928232a2e33353427
1 flag
No key requiredA Caesar-shifted sentence hides a flag. Let frequency analysis do the work. (Caesar Breaker.)
aol mshn pz mshn{mylxblujf_huhsfzpz_dpuz} huk aol zopma pz lhzf av mpuk dpao mylxblujf huhsfzpz
1 flag
The 4-digit safeAn MD5 of a 4-digit PIN. MD5 has no brute-force resistance for a tiny space like this. Recover the PIN; the flag is flag{PIN}.
88cf91a1aef212f3c2cd12406983427d
1 flag
Chained vaultThis is an AES-GCM Vault blob. Its passphrase is the flag you recovered in challenge 3. Decrypt it in the Vault, then submit what's inside.
nEoed7MC2GURrzyQK25Uxz+BDWKlR+kcdLAo1rJ2TbBc3/eDr4jYdIaHElqvnCNRZSHq/eyUEbZLnHddQtQzVn3xLYM=
1 flag
Read the modeYou just watched two ciphertexts of the same penguin. One mode leaked the image because identical plaintext blocks map to identical ciphertext blocks. The flag is flag{X} where X is that one-word property. (Hint: the opposite of "secure".)
๐Ÿ†
All six flags captured โ€” you drove every tool on the page.