Thursday, 4 September 2014

Bletchly Park 2

Also at Bletchly were the renovated huts that the likes of Alan Turing once worked in. Most of the buildings and huts are fully renovated, with the current project expected to finish in 2020. It's hard to imagine the euphoria in those huts when the codes were broken thanks to a few silly German operators sending the same words/messages frequently with the same/similar codes (which was aided further by the fact that their cypher machines couldn't encode a letter as itself).

One of the encryption techniques was to turn each letter into a series of 0s and 1s (sort of like Morse code), and then for each letter in the message add a random letter to it in a boolean 'Exclusive Or' (XOR) style. The same (a 0 and 0, or a 1 and a 1) would make a 0 when added together, and different (a 0 and a 1 or visa versa) ones would add to make a 1.


Imagine you wanted to say "Hi". For the sake of this exercise we're going to assume that A is 0001, B is 0010, H is 1000, and I is 1001. We'll also assume that the key here is AB (as in, we're adding an A and then a B).

H + A = I
1000 + 0001 = 1001

I + B = K (if we count up in binary for the alphabet like we did here)
1001 + 0010 = 1011

HI = IK


The brilliant thing about this system is that because of how it works, when you add the key to the encrypted message it will actually decrypt it:

I + A = H
1001 + 0001 = 1000

K + B = I
1011 + 0010 = 1001


Amazing.


No comments:

Post a Comment