The most famous Field Cipher: ADfGVX - And its important Role during WWI

in #security8 years ago (edited)

The famous Enigma Machine, an electromechanic rotor cipher machine that would drive the Allies crazy during the WW2, Alan Turing and his team worked to crack that code and accelerate the end of that World War. Turing, however, was not the first to cracked the code. A group of polish scientists managed to break the code and passed on their knowledge to Britain. This is with no doubt the most known story about encryption at the current date. We will be focusing in another not-so-famous example, the ADFGVX cipher, it also played a key role during a World War, the World War 1.

To fully understand the importance of the ADFGVX cipher we need to make a quick review of other classic cipher methods.

Some Mono-alphabetic ciphers (substitution of an alphabet by another one, composed of symbols or characters) are:

1. The Caesar Cipher. A method that has already been very well explained HERE. That consisted on displacing the characters a certain amount of slots. So an A, could turn into a D and a B into an E.

A similar method is the Hebrew atbash that consisted on reversing the order of the alphabets. An "A" would become "Z"; and a "C" would turn into an "X".

2. Substitution. Generally speaking, one may directly replace an alphabet for a collection of symbols, typographs or numbers. A nice example of this is the Freemason's cipher, or Pigpen cipher, that was used by the masons during the 18th century. In this cipher each character would be replaced by the graphic symbols derived out of this image (or another equivalents):

 

Another example would be the cipher invented during 150 a.c by the historian Polybius. It consisted in replacing each letter with the pair of coordinate numbers of this sheet.

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

So the message "Steem" would become:
4344151532

 

Or Francis Bacon's method that replaces the letters of the alphabet with groups of 5 characters composed by the letters A and B, A would be aaaaa and S baaab. Essentially a 5 digit binary number encoding (if we consider A a 0 and B a 1).

All this methods are easy to crack by modern means, a simple character count (if the message is long enough) would return the most "possible" letters. Frequency analysis, it is called.

The most used letter in English is the "E", by comparing a long string of data, one may infer which one of the "symbols" (letters, numbers...) is the mentioned letter.
We can also do that with words, knowing that "the" is the most used word.

3. The Vigenere cipher. Is a bit more sophisticated, and attempts to counter the frequency analysis using several substitutions at the same time (this is, polyalphabetic cipher), but it's still based in the Caesar's cipher.

First, you need a table like this:

To encrypt a message you need a keyword that will determinate the cipher result, the transposition for each character. Lets use as message "steem rocks", we write the keyword below it, in this case "timsaid", repeating it until we cover the entire message.

S T E E M R O C K S
T I M S A I D T I M
L B Q W M Z R V S E

Since below the S of "steem" there's a "T" we look at the character that crosses S & T, resulting in an L... And so on.

The cipher becomes LBQWMZRVSE.

Yet, the cyclic structure of this method makes it crackable. If the cryptoanalist believes that a Vigenere table was used, all he has to do is "suppose" the length of the keyword and separate the text in the same amount of partial texts (in this case 6 parts), then run a frequency analysis on each. This text is NOT crackable, since there's not enough text to analyse.

Now we are in condition of understanding the ADFGVX cipher, that, as mentioned, would play a key role during the WW1.

Cryptography at that time was primitive, and easily deciphered. Then Germany introduced the ADFGVX cipher (ADFGX before that), believing that they had an uncrackable method, that would give them an edge during the war, since the surprise factor is of utmost importance. This is a 2 step cipher, a substitution (similar to Polybius') and a transposition method, used by Germany in 1918, before striking Paris. The inventor Col. Fritz Nebel.

The name comes from the 6 base characters A, D, F, G, V, X, in Morse chosen because they are totally different to send; minimizing the space for errors during the transmission (a single character wrong could make a MESS).

How do you cipher in ADFGVX? To begin with, you take a 6 by 6 grid with the letters ADFGVX at both sides and randomly fill the other fields with the other letters and 10 numbers.

  A D F G V X
A O 1 S E G F
D 2 0 H A Y D
F R B Z P 4 N
G Q 9 8 C T K
V 3 X I 7 5 W
X J U 6 M V L

This is pretty much what we've already seen. Just applying the Polybius' method:

So, "Tim uses steem" would become:
GVVFXGXDAFAGAFAFGVAGAGXG

 

Now, lets add the keyword to the mix: "datkey"

D A T K E Y
G V V F X G
X D A F A G
A F A F G V
A G A G X G

This is still, too easy to crack, but we're not over (I hope I haven't lost you yet!).

Now, we need to move the columns, alphabetically.

A D E K T Y
V G X F V G
D G A F A G
F A G F A V
G A X G A G

Now, we read the coded message as normally, and send it with morse code.

"Tim Uses Steem" became "VGXFVGDGAFAGFAGFAVGAXGAG". Totally MIXED.

Simon Sigh (I can't recall which one right now) that at June 1918, Germany was at the "gates" of Paris, 100km away, and were preparing the final offensive. If the allies cracked the ADFGVX code they could've found out where the Germans would strike. Georges Painvin working day and night trying to crack the code, losing 15kg of weight in the process.

In June 2nd he cracked it, later he would get some extra messages, but knowing "how" it worked it was not a feat such as cracking it from scratch. Among the messages one said "Send ammunition, fast, even during daylight if you're not seen". The place where this message was sent from was identified, 80km away from Paris. Since the ammunition reinforcement was mentioned, the Allies guessed that that was going to be the "Hotspot" of the German strike; being prevented, the Allies won.

This article is written by @renzoarg. He's a coauthor and 100% of the SBD goes to him. This article is part of the Steemit Crypto Challenge. We will post more about the world of encryption, ciphers and security so that you are prepared for the puzzles. Don't miss the Steemit Crypto Challenge. [Follow @renzoarg and remember to upvote.]
Sort:  

Your article have a kind of a mistake in the first lines. It is a known thing that Turing 'worked' on Enigma, but most people does not know, that in fact, Enigma was cracked thanks to the group of polish mathematicians. Without them, the story might have never exist.

Thanks for the hint radoslaw,

I will add this to the article since they deserve the respect for their work.

The early code was broken, that's where Turig "knew" how the machine worked (besides the fact of having one in posession).
They also told him how to build an electromechanichal device that could cycle settings.

But, giving them the credit for building the machine that decoded enigma messages in "no time". Is like giving a marble miner the credit for Michelangelo's "David".

he is right, the polish guys broke enigma

fricken sweet man keep it up!

That is sooo cool, I have never seen anything like this before!

I still think your food is amazing! Need to try a recipe

Damn, those old times when people used paper and pencil to do encryption, and now my lazy ass just uses 1 command to do AES-256 which is much more complex.

Yeah, that was something I commented at the chats some days ago. Today it's easy for us to permutate a string into several until we get a result.

They did it, with chalk and blackboard; not to mention... Decryption!

Well they were talented at math that is sure. I just love technology, it makes everything easier.

For me RSA was a game changing (and Diffie-Hellman too but well I like prime number). That's when cryptology went from pen and paper to the next level. As the classical one I like Vigenere and how it was broken.
Nice post!

I find crypto fascinating, even if I don't understand it all. I have great admiration for those who can find the weaknesses and exploit them. Even modern crypto has been found to have issues. It's a constant arms race

its crazy guys...nice posting

Hi, please include references for your claim that the Polish cracked the 'code', thanks

How to butcher an article... Bot style.