RowdyHacks XII: A Small Toolkit

A 250-point crypto challenge: a Vigenère letter revealed a key, a four-digit PIN fell to a tiny hash search, and its SHA-256 digest XOR-decrypted the flag.

RowdyHacks XII

crypto250 ptsvigenereknown-plaintextbrute-forcexor

Challenge

Cryptography · 250 points. The archive has three files meant to be read in order: 01_letter.txt, 02_lock.txt, and 03_locked.bin.

Step 1: Vigenère (known plaintext)

The uppercase line in 01_letter.txt is Vigenère ciphertext. Its opening is the pangram THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.; subtracting that known plaintext from the ciphertext reveals the repeating key SECRETKEY. The letter then points to the lock file.

Step 2: the PIN (tiny keyspace)

02_lock.txt gives a SHA-256 hash of a four-digit PIN with no zero. That is only 9^4 = 6561 candidates, enumerate them and match the hash to find 7391.

Step 3: XOR with the digest

As the lock instructions specify, XOR each byte of 03_locked.bin with the corresponding byte of the raw SHA-256 digest of ASCII 7391, repeating the digest as a keystream. That produces the flag. The three steps are independent and each one hands the next its input.

Takeaway

The name is the lesson: XOR with a short, derivable key is not encryption, and the two weaker locks fall because their keyspaces are tiny, a four-digit PIN is searched instantly and a repeating Vigenere key breaks to a known-plaintext crib. Real confidentiality needs a proper cipher with a high-entropy key, not an invertible transform keyed by something guessable.

Flag

Spoiler: show the flag
flag{xor_is_not_encryption}