Most of the puzzles here revolve around an unknown algorithm attack. That is, you are given an enciphered piece of text and asked to decode it (and often given a series of hints which describe how the enciphering was done), or you are given a set of plaintexts and enciphered texts and asked to describe the manner in which the text was enciphered. In this puzzle, you will be asked to do something different. I will describe a custom cipher, and give an implementation, and then ask you to decode an enciphered text. Hopefully, if nothing else, you'll learn a bit more about cryptographic weaknesses.
Just so you are sure, any method of deciphering the text is fine. If you want to write a program to bruteforce the cipher, go ahead. With that in mind, let's begin...
Part 0: A Basic Caesar Cipher
Unless you've been living under a rock, you'll know about the basic Caesar cipher. But for those of you who like living under rocks, here's a basic rundown of how it works (note that the method may seem convoluted, but it's useful for later):
Start with your plain text.
Attack at sundown, when the enemy isn't looking.
Then remove all spaces and punctuation (this is not strictly necessary, but we'll do it anyways)
ATTACKATSUNDOWNWHENTHEENEMYISNTLOOKING
Decompose the text into numbers, A=0, B=1, ...Z=25:
0 19 19 0 2 10 0 19 18 20 13 3 14 22 13 22 7 4 13 19 7 4 4 13 4 12 24 8 18 13 19 11 14 14 10 8 13 6
Choose a numeric key between 1 and 25; we'll choose 7. Then add the key to each number and take the result modulo 26, that is, if the number exceeds 26, subtract 26 until it's smaller than 26 (e.g. If you have 30, then 30 modulo 26 is 30-26 is 4).
7 0 0 7 9 17 7 0 25 1 20 10 21 3 20 3 14 11 20 0 14 11 11 20 11 19 5 15 25 20 0 18 21 21 17 15 20 13
Then convert back to letters:
HAAHJRHAZBUKVDUDOLUAOLLULTFPZUASVVRPUN
To decrypt, you do the same, except you subtract the numeric key. That said, this cipher is very easy to break. To prove it, here's a challenge:
Challenge* 0: Decode the following:
SQUIQHMQIDEJQLUHOWEETSHOFJEWHQFXUH
* Note that this is a gross misuse of the word 'challenge'.
Part 1: Keyed Caesar
Now we've got that out of the way, let's get on to something more interesting. The problem with a Caesar is that it's too easy to bruteforce. Once you know it's a Caesar cipher, you can easily check all the possibilities. So let's fix that, by introducing a longer key. In part 0, we had a single numeric key that was applied to every letter. What we're going to do is have a group of keys and apply them in turn. For example, if we had the keys 4, 19 and 8, we would shift the first letter 4 places, the second 19, the third 8, the fourth 4, and so on. In this way, one can not simply check all the possibilities**, and a more elegant approach is needed to crack the cipher.
** Well, you could check all the possibilities, but that would be really boring.
Here are three implementations of this cipher in different languages. If you can't program, or don't program in any of these languages, don't worry: The implementations are heavily commented, so just read the comments.
However, this is still a weak cipher, and you can prove it by decoding the following:
Challenge 1.1: Length 2 Key
QGUUEBBADCJDJSEEIJEPLAHUWKEZRASWKOUEJEIWBIEOJPXAIIQAQOQJENCWBYQAIWHYYLXAHWDZOKKYQJIPYHBXHQJAVKHYUPXASKCXYJQPYKDXKPYBOKKOEHLATPXEIWDWBUJESWBHOUEQQNUZEEDCMABHRASWKOUPXAIWCAJASDDEGQUYQJRAQLFHYATPEXHAQGJDYOSEFDUNMEJDQJOGUUBADCJDXAHAIOEIUIENUPUTJPXAGQYYAXHKMJVKNFKIFATKLAHPXABWPUTKW
Challenge 1.2: Length 6 Key
EWEVDKHHVYEKIKELPNUWXXGRAOYFXOMESNMDAZXAXXQVXPTUFRQTDAMSSBGPUVABMDRREFBJSDXMAAYRYMANTHXHKEODRWEAFWIKLBUOPXWLDLQTKEXBABMDQAGETIMWMHGLALRMLZAQXUXHUHZXTSAUHHYEFWLHNCTWLXMNGWLBLPTDXBMLDRJXLOQVXATPMSPTNOUEPXXTOXWXBOMVEMBORDGMHNKVYULPUWYMXBAUTXKBAUQTGYQWLTMYAQGXIPUVSYVKGUWXVKYSPXMANXRDUUMQCLMNQWGAHBFKIBFWSLRTMEAQLHPAHHVBMEEEYGDPTDXATOEXVOBRQGZBKPGDPERQZFLTGCQGJKHIIKIGBPIDWYBNEWTKHLAVIWGAMUPRAWXIEVXJFXVRTCAECVTQEWMVFWPPIGMKUWWIKAEHRMBJODVGTPURRBGOFDGDHRQUJEHSEYMEXAJFYLXOEWEVDKHHVYEKIOSOXOGVMGZXUJAHKZEOMDXQZGIFHJEWVTMEHHRXLOMQHNGLDRTHKPURRTUHQQ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ZUBJTYUNYXGOWWFQZHQJNFMDRXUAAEKTTJRGTBAECBRPUKOTJQUOEUGNFGUBADTJHTMXWFNZHQEZSXWGOTXKAVVKASAOVPVUOTHCXPZNNSNBJTUSAUTKOBYZGDKKFUSPDNZFOAEGMLKLUVKACXPUWORZGKGZIXKARZINBMSTIZKSMDRHFZEATFKEFZBEGVTHMKZGORLEUHKWZSFKORYQXYVGMEUVTPGHVTFYKEANLWEKQKKOGCEUZGLBJTYJFEYGSLJVJFKAZGSDORDDXLGZIXUEKTTUVTHMDNZUAAVXPPJSGWHNVZFEWAMVTCRRJUNNXZYNNSFPKEQUXTGKEBPBXIHOGOOZAABJKKASFGPVYUAAOKTMAIGIADUNIAOBTPPPUKCXCVTOXNVYSXWYRZVKALVLAQZIXUEKSXLRGUXZYEUHHQZITPGNFBNTOWXJPNPBYRUGMKBRTBOFUNXDBCUXNEOCEARBFGPUUVZDGNFRORKNMKOKEHEAMPDSVZIBPNZUAAZUNXJGHVMAIKOPKEYFXRRXZLKPGMEAQKYIAEZJLNRIPFIRTEBJTGEBBSKSXJGYFMKSZPHHFZPEANXOPDBOTKETNUPDNZTAKHREMDREEHJRDU
Part 2: Hardened Keyed Caesar
The Keyed Caesar was a step in the right direction, but it's still reasonably easy to crack, because of certain weaknesses (no, I won't reveal the answer to part 1 in part 2!). So we're going to harden it some more. The Hardened Keyed Caesar will feature a global increment. This means that the nth letter of the plaintext will get shifted k*n places, where k is the global increment. So if your global increment was 2, the first letter would get shifted 2 placed on top of how it's shifted by the key, the second letter 4, and so on. This makes the cipher much more resilient to certain attacks.
Here's the implementations:
"Hang on", you say, "in a real situation this would be on large chunks of text, and I'd know a bit about the context. The shortness of the challenges add artificial difficulty!". And you'd be right; that's why, for the next challenges, I'll provide a pastebin of a LARGE chunk of text encrypted by this cipher. I'll even tell you what it's about!
Challenge 2.1: Length 2 Key Plus Increment
Challenge 2.2: Unknown Length Key (<= 7) Plus Increment
What more can I say? Happy cracking!