Pages

Categories

Cryptography

Cryptography
Published on 22 March, 2014
Cryptography is a technique used to securely communicate a message between two parties
without a third party being able to decipher the true message.
Definitions:
 Alice & Bob – The parties that wishes to send/receive a message securely.
 Eve – The eavesdropper who wants to read the messages passed between Alice and
Bob.
 Plain Text – The message in its human readable form.
 Cipher Text – The message after it has been encrypted.
 Encoding – The act of applying an algorithm to data (usually plain text) to produce a
new output; the cipher text.
 Decoding – The act of applying an algorithm to data (cipher text) to produce the
original data before it was encoded.
 Crack – The breaking of an encrypted message, finding out how to decipher it.
 Bruteforce – The act of attempting every possible combination of keys to find one
that is able to decrypt the message. Often requires a lot of computing power.
 Symmetric Encryption – An algorithm that uses the same key for both encrypting
and decrypting the message.
 Asymmetric Encryption – An algorithm that uses two separate keys, one for
encrypting it, and another for decrypting it. Both keys are mathematically related.
 Public Key – The key shared out for users to encrypt data with.
 Private Key – The key kept secret that can decrypt data that used the public key
during encryption. Both private and public keys are mathematically related.
The above diagram shows a typical example of the process taken from plain text, encryption
to cipher text, and decryption back to plain text. Alice is the party sending the message to
Bob, and Eve, although intercepting the data transferred, cannot read it.
One Time Pad:
The one time pad is the best way to encrypt a message that if used correctly is impossible to
crack. This is achieved by having a random secret key that is of the same length of the
message, and the message is then combined with it through modular addition. The secret key
is only shared with those that are allowed to decrypt it (Alice, and Bob). Due to the
randomness of each value in the key, there are no patterns in the cipher text; unlike what can
be found in the result of using the Caesar cipher where the same input will always have the
same output.
Caesar Cipher:
The Caesar cipher, named after Julius Caesar who used this method of cryptography for
communication. It is one of the most basic forms of symmetric encryption. A Caesar cipher
works by shifting the letters of the alphabet by a set amount of places. For example the letter
‘A’ shifted right by 2 places wold become the letter ‘C’, ‘B’ would become ‘D’, ‘X’ would
become ‘Z’, ‘Y’ would wrap back to ‘A’, and ‘Z’ would wrap back to ‘B’.
The above diagram illustrates how the characters are shifted along the alphabet by a key of 2
places, and how it wraps around at the end of the alphabet to the beginning.
One main disadvantage of a Caesar cipher is that each character when passed through the
algorithm, will always have the same output. This is an issue as patterns can be found in
words; for example when a word contains two letters next to each other, a match of common
letters found together in words can be used to guess the key. For example the string “hello”
with a shift right of 2 would become “jgnnq”. It is then relatively easy to find a 5 letter word
where the two character positions at “nn” are the same. For example, a compiled list of
English words that can be found here, when searching for words a length of 5 and where the
3rd and 4th character are the same produces this list of words here.
An implementation of the Caesar cipher written in C# can be found on my github account
here.
Filed in Uncategorized | No replies