Search This Blog

Wednesday 26 August 2015

My Cipher

Today’s blog is a bit different, I'm sharing with you an interest I have in cryptography and a cipher I had written myself. I hope you enjoy it and can understand it!

When I mention cryptography today, what do you think of? Public key encryption with 1024 bit key strength? Supercomputers, mind melting mathematics and computer programming? This is what I thought of and at first it put me off even though I was interested in this fascinating subject! The level that today’s cryptography has reached seemed unreachable and un-achievable to me, but then I realized I was looking at the wrong end, I needed to look at the beginnings of cryptography, at how it first came about and changed over the years as people constantly evolved it to withstand the attacks by people who sought to break them!
Hand written cryptography may seem obsolete today, there are many products on the market that provide a service to secure information, but where is the fun in the using someone else's product/solution? I have read books on the subject but I would never claim to be an expert. I have had a lot of fun in the creation of my own code. I believe it is strong but I would never in a million years say it was un-crackable. The very fact that you have written your own code in it self adds strength to it as it is an unknown quantity to any attacker. So why am I writing this? Should I not keep my code secret, locked away and jealously guarded? No. The strength is not in how the plain text is converted into cipher text but in the key used. If the attacker does not possess the key it does not aid him knowing how the cipher works. It does allow for a brute force attack but now we are straying out of the realm of hand written ciphers into the world of computer programs written specificity to break a given cipher. The key I use is 148 characters long, I'm no good at mathematics, perhaps someone reading this and interested enough could tell us how long/hard that would be to brute force? My thoughts on the matter is good luck! I am not sending or storing state secrets, I just want to protect my private thoughts or messages to loved ones via public forms of communication. I am assuming that the difficulty to crack the code plus the fact the information is of little interest will put off most attackers.
By public forms of communication I mean, emails, texts, documents stored in 'the cloud' and posts online in public forums like face book. Most of these you might think are private because they are sent directly from the sender to a recipient or stored in a private space online that only you have access to. It has been proved time and again that these are not secure and people can and will gain access. Governments, the press and hackers to name three groups of talented people who have a vested interest in your information.

My code uses a table that in the center of it is a square 37 x 37 characters. These characters are the plain text characters used to write the plain text. For this example of my code I will just use the letters of the alphabet which will give me a grid of 26 x 26.

On each face of the grid are the characters of the cipher text. These can be anything you want but to make it easy I will just use the alphabet in a randomized form. You will have four randomized alphabets one on each face of the grid and this is our key also.

Below is an example of the table. In red is the characters used as the cipher text and in blue are the plain text characters. In-between in yellow are numbers running in sequential order from 1 too 104 around the blue square, these are the character numbers. Take the word 'revenge' there are seven characters in the word, R is number one and the finale E is number 7. To encrypt this word using the below table we take the letter R go to column 1, we move down the column until we reach the letter R and then follow the row across to the right until we meet the cipher text letter in red which is O. The second character is E, we move too column 2 and follow it down to the letter E and then along the row to the right until we reach the cipher text letter in red which is X. Repeat this until the process is complete and 'Revenge' becomes 'oxelogh' To reverse the process take O we know it's the 1st character, so we find the letter O in the red column on the right hand side of the table and follow the row to the left until we reach column 1 and we have the letter R.

When we reach character 27 you will notice that it has moved round onto a different face of the blue square. We can ether rotate the table anti clockwise and continue or keep it the same way but now you follow row 27 across to the left until you reach the plain text letter then follow the row down until you reach the cipher text letter in red. From 53 to 78 you follow the row up and then to the left and from 79 to 104 you follow the row to the right and then up. When you get back to position one again you have completed a block of 104 cipher text characters and the sequence starts again at position 1.



Q W E R T Y M U I O P A S D F G H J K L Z X C V B N



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

P 104 A Z Y X W V U T S R Q P O N M L K J I H G F E D C B 27 M
O 103 B A Z Y X W V U T S R Q P O N M L K J I H G F E D C 28 N
L 102 C B A Z Y X W V U T S R Q P O N M L K J I H G F E D 29 B
K 101 D C B A Z Y X W V U T S R Q P O N M L K J I H G F E 30 V
I 100 E D C B A Z Y X W V U T S R Q P O N M L K J I H G F 31 C
M 99 F E D C B A Z Y X W V U T S R Q P O N M L K J I H G 32 X
J 98 G F E D C B A Z Y X W V U T S R Q P O N M L K J I H 33 Z
U 97 H G F E D C B A Z Y X W V U T S R Q P O N M L K J I 34 L
N 96 I H G F E D C B A Z Y X W V U T S R Q P O N M L K J 35 K
H 95 J I H G F E D C B A Z Y X W V U T S R Q P O N M L K 36 J
Y 94 K J I H G F E D C B A Z Y X W V U T S R Q P O N M L 37 H
B 93 L K J I H G F E D C B A Z Y X W V U T S R Q P O N M 38 G
G 92 M L K J I H G F E D C B A Z Y X W V U T S R Q P O N 39 F
T 91 N M L K J I H G F E D C B A Z Y X W V U T S R Q P O 40 D
V 90 O N M L K J I H G F E D C B A Z Y X W V U T S R Q P 41 S
F 89 P O N M L K J I H G F E D C B A Z Y X W V U T S R Q 42 A
R 88 Q P O N M L K J I H G F E D C B A Z Y X W V U T S R 43 P
C 87 R Q P O N M L K J I H G F E D C B A Z Y X W V U T S 44 O
D 86 S R Q P O N M L K J I H G F E D C B A Z Y X W V U T 45 I
E 85 T S R Q P O N M L K J I H G F E D C B A Z Y X W V U 46 U
X 84 U T S R Q P O N M L K J I H G F E D C B A Z Y X W V 47 Y
S 83 V U T S R Q P O N M L K J I H G F E D C B A Z Y X W 48 T
W 82 W V U T S R Q P O N M L K J I H G F E D C B A Z Y X 49 R
Z 81 X W V U T S R Q P O N M L K J I H G F E D C B A Z Y 50 E
A 80 Y X W V U T S R Q P O N M L K J I H G F E D C B A Z 51 W
Q 79 Z Y X W V U T S R Q P O N M L K J I H G F E D C B A 52 Q


78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53



Q Y W U I E O R P T M N B V C X Z L K J H G F D S A



In the hand written form this cipher is only really good for short messages/texts/posts I hope to learn to program to automate the process. I did find a kind person who did this for me but it was saved on a floppy disk and has been lost. It was nice and simple, a box to enter the key, a plain text box and a cipher text box.

An example.

This is what a short passage looks like

ukht fe bsln h vunxk xohgynm kfdzt lghy

Take out the spaces
ukhtfebslnhvunxkxohgynmkfdztlghy

you'll notice that the double letters in the words used are not replicated in the cipher text. This example uses a basic table the full one I use, uses spaces and numbers as well. The blue square in the center also does not need to be laid out in order as I has shown here it can also be randomized.

The process is a bit laborious and if your not concentrating it is easy to lose your place. I will eventually learn to program in order the make the process fast and error free.

I hope you like this and maybe it will encourage some of you to take your first steps studying this fascinating subject. 


No comments:

Post a Comment