Monday, March 2, 2020

The Spreadsheet Cipher: My fun little experiment in creating a cipher system

I've been reading up on cryptology for a while, so I thought I'd try my hand at making a cipher of my own, just for fun. It's not anywhere as secure as modern-day cipher systems, my version is a modified variant that borrows elements from several classical ciphers that have fallen out of regular use, but that all said, I designed this cipher to be fairly secure and easily usable for anyone with access to a spreadsheet program like Microsoft Excel or LibreOffice Calc.

Now, a little background. It's a polyalphabetic (uses more than one series of letters in several rows) substitution cipher with a key system similar to that used by the M-94 and M-138 that were the brainchild of US Army officers Joseph Mauborgne and Parker Hitt. My version uses an altered variant of the alphabet tables used by Blaise de Vigenere, but I otherwise want to avoid the security flaws of the Vigenere system. I also decided to take some hints from the one-time pad system, particularly the German variant the Weimar Republic used in 1923 and became the regular standard for most espionage organizations even to this day.

The resulting 26 x 26 alphabet tables I came up with looks like this:


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


Now, by itself, this is just some bog standard series of alphabet tables. As one might be able to guess, one is to decrypt one line or paragraph at a time using this system, and any non-letter symbol can be used to denote spaces between words if you like (I discourage this to prevent frequency analysis based on word length, nulls are an easy tell to suss out cipher solutions in this case). Now for this cipher to maintain security, the spreadsheet keys will come on a separate page, each line or series of lines to decipher prefaced by a number in this format before the ciphered text : (1+2)


The first number denotes row one is the plaintext, and the second number is the row used for the cipher text.


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

Using the above with the first two rows assumes that the plain text "This is an example" will render the following in ciphertext (without spaces)

KYZJZJREVORDGCV

With knowledge of the key for the plain and cipher text rows, we can render this back into intelligible words.

For security purposes, the letters in the rows can be randomized on occasion to make for a one-time pad system, and so long as you keep the keys for each line secure between you and the party you want to solve the message and you each have an updated copy of the alphabet tables, it will drive the average cipher solver a little crazy if they don't know how to decrypt the ciphertext without knowing which row helps recover the actual text. I used a modified version of classic Vigenere tables for my demonstration, but any 26 x 26 series of randomized tables using a standard A-Z alphabet with every line using each letter just once will work fine and can be adapted to any spreadsheet program and keys for solving each line of text can be easily created. You can enhance security further by limiting each key to a single word if you really want to frazzle cryptanalysis by a third party, without knowledge of the key lines for decipherment, even having the whole table will give them far too many possibilities to check without knowing the exact keys for decipherment of each item that keys are assigned for decrypting.

Now, this method is not foolproof. Frequency analysis of certain letters by a dedicated cipher solver can eventually break the encryption shield, my method is very similar to the US Army M-138A strip cipher the Germans finally cracked in 1944, but uses a slight different keying method. Regardless, the logic is similar between both encryption systems.

It would be possible to go by columns instead of rows for cipher and plaintext for this method, which would add some extra difficulty to guessing the actual key for the cipher. One can also add a THIRD line to encipher the ciphertext to create a super encipherment, which would really annoy third-party cryptanalysis.

Now, I just want to reiterate this is just something I came up with for fun. I don't advise anyone seriously put their faith in this to hide anything important, it was just a fun little experiment I did after reading a lot of texts on cryptology recently. Besides, everything I based this on is public domain knowledge, and in the cryptology world, anything in the public domain is not and will never be foolproof.

No comments:

Post a Comment

Asiago Pressato, Pecorino Calabrese, and Green Wax Irish Cheddar, my impressions

 It's been a while since my last cheese review, so let's make up for that, shall we? This time I ordered a pound each of Asiago Pres...