Private Key Encryption Tutorial

 

The process of encryption starts with the original message (plaintext), which is encrypted to ciphertext using an encryption algorithm and a Key. Then the ciphertext is sent to the recipient.  On the recipient's end the user decrypts the message using the same algorithm and the same Key (in case of symmetric encryption) that has been agreed between the two.   In fact there is only one piece of hardware to both encrypt and decrypt and the processes of encrypting and decrypting are one and the same.  Plaintext is encrypted once to get the cyphertext.  Cyphertext is encrypted once more using the same key and result is plaintext.  There are a number of points to consider;

  1. Algorithms are usually well publicised.
  2. Length of key is known.
  3. Encryption key is kept private.
  4. For a given algorithm, strength of encryption is in the length of key.
  5. Given time and computational power, encryption can be broken.

 

Here is a brief introduction to the XOR algorithm

 

XOR is one such algorithm for symmetric encryption.  The basic underlying principle of XOR is binary addition.  

 

0

^

0

0

0

^

1

1

1

^

0

1

1

^

1

0

 

Task list

 

Today we will be doing an encryption/hacking to decrypt exercise.  We will use XOR algorithm and a 4-bit key to encrypt 8-bits at a time.  The idea is to encrypt a meaningful four-letter name and pass it on to another group to hack.

 

Now the tasks for today’s tutorial

1.                  Get into groups of 3 or 4  (a group of 4 should be of higher computational power than a group of 3)

2.                  Choose a four-letter word, which has a meaning, don’t choose acronyms. You could choose a name.

3.                  Now the next step is convert the word into a binary number.  You can use the following website to do so:

                  http://www.theskull.com/javascript/ascii-binary.html

4.                  Select a 4-bit key to encrypt the word using XOR algorithm and 8-bits at a time.

5.                  Convert encoded binary number to text. And exchange your text with another group.

6.                  Try all possible 4-bit keys to decrypt the cyphertext until the decrypted word is meaningful.

 

There is a worked example at the end of this document to help you.  The group that decodes the message first wins!!!  Remember this is a competition so try and win it for your group.

 

Note that you need a devise a strategy for the decrypting process. It may be a simple strategy; nevertheless you need one to win.

 

Worked example

 

Here is the worked example, the text that we are trying encrypt is “FRED”.

 

Word is “FRED”.

1.                  Binary equivalent of FRED is found.

2.                  A key and an algorithm are chosen.  In this case '00000011' and 'XOR' respectively.

3.                  XOR encryption is applied text equivalent of binary is found.  Cyphertext is 'EQFG'.

4.                  In order to hack, a number of possible 4-bit keys are used starting with '00000001' and ending with '00001111' ('00000000' is not a choice.  Why?).

 

Text

Binary

Key

FRED

01000110  01010010  01000101  01000100

00000011

 

To apply an 8-bit encryption you need to break-up your binary number into 4 parts, and then apply the XOR encryption

 

01000110

01010010

01000101

01000100

^

^

^

^

00000011

00000011

00000011

00000011

01000101

01010001

01000110

01000111

01000101  01010001  01000110  01000111

EQFG

 

Once you have encoded the text, you will have to decode the text using all the possible keys and then check the messages to see if it makes sense.

You could see here I have used all the keys and only one of the decoded texts makes sense.

 

Text

Encoded Binary Equivalent

Key

Decoded message

EQFG

0100010101010001010001100100011

 

00000001

01000100010100000100011101000110

EQFG

0100010101010001010001100100011

 

00000010

01000111010100110100010001000101

EQFG

0100010101010001010001100100011

 

00000011

01000110010100100100010101000100

EQFG

0100010101010001010001100100011

 

00000100

01000001010101010100001001000011

EQFG

0100010101010001010001100100011

 

00000101

01000000010101000100001101000010

EQFG

0100010101010001010001100100011

 

00000110

01000011010101110100000001000001

EQFG

0100010101010001010001100100011

 

00000111

01000010010101110100000101000000

EQFG

0100010101010001010001100100011

 

00001000

01001101010110010100111001001111

EQFG

0100010101010001010001100100011

 

00001001

01001100010110000100111101001110

EQFG

0100010101010001010001100100011

 

00001010

01001111010110110100110101001101

EQFG

0100010101010001010001100100011

 

00001011

01001110010110100100110101001100

EQFG

0100010101010001010001100100011

 

00001100

01001001010111010100101001001011

EQFG

0100010101010001010001100100011

 

00001101

01001000010111000100101101001010

EQFG

0100010101010001010001100100011

 

00001110

01001011010111110100100001001001

EQFG

0100010101010001010001100100011

 

00001111

01001010010111100100100101001000

 

01000100010100000100011101000110

DPGF

01000111010100110100010001000101

GSDE

01000110010100100100010101000100

FRED

01000001010101010100001001000011

AUBC

01000000010101000100001101000010

@TCB

01000011010101110100000001000001

CW@A

01000010010101110100000101000000

BWA@

01001101010110010100111001001111

MYNO

01001100010110000100111101001110

LXON

01001111010110110100110101001101

O[MM

01001110010110100100110101001100

NZML

01001001010111010100101001001011

I]JK

01001000010111000100101101001010

H\KJ

01001011010111110100100001001001

K_HI

01001010010111100100100101001000

J^IH