Khan Academy Cryptography Challenge

This page contains the solution to the Khan Academy cryptography challenge.

## Clue 1

Clue 1 contains a simple Caesar cipher. Once you transcribe the message, open up any Caesar cipher decryption tool to decrypt it.

**Message 1:**
`gluhtlishjrvbadvyyplkaohavbyjpwolypzavvdlhrvuuleatlzzhnlzdpajoavcpnlulyljpwolyrlfdvykpzaolopkkluzftivsvmklhaoputfmhcvypalovsilpuluk`

**After shifting 19 letters:**
`zenameblackoutworriedthatourcipheristooweakonnextmessageswitchtovigenerecipherkeywordisthehiddensymbolofdeathinmyfavoriteholbeinend`

**Reformatted:**
`ze name blackout worried that our cipher is too weak on next message switch to vigenere cipher keyword is the hidden symbol of death in my favorite holbein end`

**Message 2:**
`vwduwljudeehghyhubwklqjlfrxogilqgsohdvhuhwxuqdqbeoxhsulqwviruydxowdqgdodupghvljqedvhgrqzklfkedqnbrxghflghrqldpvhwwlqjxsvdihkrxvhfr`

**After shifting 23 letters:**
`startigrabbedeverythingicouldfindpleasereturnanyblueprintsforvaultandalarmdesignbasedonwhichbankyoudecideoniamsettingupsafehouseco`

**Reformatted:**
`start i grabbed everything i could find please return any blueprints for vault and alarm design based on which bank you decide on i am setting up safe house co`

Note that the "hidden symbol of death" refers to a painting by Hans Holbein. The keyword here is "skull" (Note: The exact keyword has the letters repeated)

## Clue 2

Clue 2 contains a Vigenère cipher. One of the clues given by the challenge is "multiplying by 2", which means that the letters are repeated. Therefore, the keyword is "sskkuullll".

**Message:**
`Klkbnqlcytfysryucocphgbdizzfcmjwkuchzyeswfogmmetwwossdchrzyldsbwnydednzwnefydthtddbojicemlucdygicczhoadrzcylwadsxpilpiecskomoltejtkmqqymehpmmjxyolwpeewjckznpccpsvsxauyodhalmriocwpelwbcniyfxmwjcemcyrazdqlsomdbfljwnbijxpddsyoehxpceswtoxwbleecsaxcnuetzywfn`

**After Decryption:**
`startwarningiheardreportofourbreakinonthenewsstillwaitingonalarmtests chedulesiwillreportbacktomorrowwithfinalplanforextrasecurityisuggestwebu rnourlettersafterreadingandswitchourletterstonumbersusingpolybiussquared`

**Reformatted:**
`start warning i heard report of our break in on the news still waiting on alarm test schedules i will report back tomorrow with final plan for extra security i suggest we burn our letters after reading and switch our letters to numbers using polybius square drop message under the bench at train station end`

## Clue 3

Clue 3 contains a Polybus squared cipher. The key is that 1,1 stands for A, 1,2 stands for B, and so on. The letter 'Z' is ignored as it does not appear. Using dcode.fr, we are able to decrypt the message easily:

(Remember to select 'column, line'!)

**Message:**
`4454113454112333534454124243424432514121231131135315544254424442434432514153435432423441112551355334134243225343114454345343225134314214325134125334121554153451335144441122514442544244441534512355154321345111131121235142543153332142435144531534143451254253154433515432534144343513544`

**After Decryption:**
`startalmostfinishedblackoutitisinshedonthirdaveworkingonastrongercipherforfuturemessagesitissurelyunbreakableitcombinesourpreviousmethodsrwktd`

**Reformatted:**
`start almost finished black out it is in shed on third ave working on a stronger cipher for futher messages it is surely unbreakable it combines our previous methods rwktd`

Special Note: There are a few numbers that have been cut off. If we add a 3 in the middle in "4343" near the end, we see the the last word is "news".

## Clue 4 and Solution

This one is probably the toughest one, as the glyphs you saw in "The Discovery" were encrypted using multiple steps. For those who want a fast solution, simply copy and paste the program found in the link below to a Python 2.7 repl.it:

https://www.coastalvectors.com/blog/2016/10/2014-crypto-challenge/

The solution is below:
`startcibcbankseeschematicsforalarmandvaulthittomorrowat10amafteralarmtestvaultcodeis5567meetatblackouten7`

`start cibc bank see schematics for alarm and vault hit tomorrow at 10am after alarm test vault code is 5567 meet at blackout en7`

## Explanation

This is taken from the Coastal Vectors link, and describes the **encryption** process:

1. First, we convert the letters in the message to numbers, using the Polybus square below. The spiral pattern is hinted by the image you see in Clue #4 (Message -> #). You start by reading the row, and then the column.

`FGHIJKEXYZ0LDW781MCV692NBU543OATSRQP`

2. Then, we convert each of the 2 numbers (separately) to a 6 bit binary number. For example, 1 becomes 001, 5 becomes 101, etc. In the Crypto checkpoint 2 exercise, the word "hi" converts to 0203, which becomes 000010000011.

3. We convert the pad (which is the newspaper article in the discovery) to a binary string. Ones are represented by vowels and y, and other consonants are represented by zeroes. Other characters (whitespace, commas, etc) are skipped over.

Here's the python 2.7 code to speed this up:

# Convert pad to binary
vowels = ["a","e","i","o","u","y"]
padbin = []
pad = "open me to read"

for c in pad:
 if ord(c) < ord('A') or ord(c) > ord('z'): continue
 if c.lower() in vowels :
 padbin.append(1)
 else:
 padbin.append(0)

for x in range(len(padbin)):
 print padbin[x],

In the second crypto challenge, the pad "open me to read" translates to 101001010110.

4. We XOR the two. We can use the XOR calculator at http://xor.pw/ to do this by machine.

5. We split the result into blocks of 4 numbers. For each block, we split the 4 numbers into 2 groups of 2. We then convert it as follows:

 01
 10
 11

For example, if we originally had 0010, we would now have 0,2.

Now, according to the pictogram above, convert the numbers into a symbol. In our example of 0,2, there would a line pointing up and a line pointing northwest.