Thursday, 11 June 2020

Fialka - The Soviet’s Unbreakable Code

This blog comes under the mini-series ”Decrypting World War 2 communications”. Though the machine we are talking about today was used during the cold-war era.

The M-125 with code name Fialka was an electromechanical based cipher machine developed after World War 2 during the cold-war era. Both the Soviet Union and United States had extensive nuclear capabilities which weren’t possibly considered to be mere a normal power because it had the capacity to devastate not millions but billions and that’s why an utmost secrecy was an ultimate significance. Enigma was considered to be the most powerful encoded form of communication but it has already been broken by the rival allies by the end of world war 2 and the more secure successor, the Lorenz was also decoded by the British cryptanalysts. Therefore, something more powerful was the requirement.




Fialka was introduced first in 1956 which soon became one of the favorite cipher machines of the Warsaw Pact and some allied nations like Cuba. The original M-125 was succeeded by the M-125-3M in the 1960s and remained in use till the early 1990s. 


History


Fialka means a rather small flower; violet in Russian but contrary to its name, it wasn’t a delicate item but a very powerful machine. M-125 and M-125-3M were the two basic versions of it and “Fialka” word was actually the cipher procedure but since most people called the machine “Fialka”, it became popular with the same. 
Similar to the mechanism to Enigma, the German popular, it also used electromechanical cipher wheels to scramble the actual text. Whenever a user typed any letter, the wiring inside changed and the alternate alphabet was visible and till this, the similarity was present.  

Unlike printing it on a lamp-panel, it directly printed in on a paper-strip and at the same time, it had the capacity to punch the letter in an 5-bit digital code and in addition to that, a paper tape transmitter was also equipped with it to transmit or duplicate a message. The following improvements were made in Fialka regarding the flaws of Enigma: 

10 wheels were indulged into the machine rather than 3 to 4 wheels to complicate more and the adjacent wheels rotated in the opposite direction.
  • The wheel turnovers were more frequent to baffle the enemy.
  • It was possible to change the wheel wiring on the field in case of sudden attack.
  • A single letter can be encoded into itself which was impossible in Enigma.
  • The auxiliary features especially added to make it more powerful were:
  • The use of letters, numbers and punctuation marks.
  • There was a possibility to duplicate a punched-paper tape.
  • It was suitable as a standard teletype machine.
  • It supported both Russian (Cyrillic) and Latin Alphabets which was helpful for all allied nations.


Working


It had two electrical components, one at the left and one at the right. All controls were conveniently spread over the body of the machine. After connecting the machine to the Power Supply Unit (PSU), it was switched ON by placing the ON/OFF switch in the БКЛ.-position. When typing a message, a copy holder can conveniently be raised to hold the message form. A ruler holds the form in place and can be used as a pointer by moving it up and down. 





Mode of Operations


 A three-position lever in the large circular “blob”  is used to select the required mode of operation. It is called the MODE selector and is used to select between Coding, Decoding and Plain Text. 

Russian/Latin


The basic Fialka machine supports 30 different characters designed for Russian language and Cyrillic character set. In order to avoid mechanical complexity of the electric wheels, the 30 most frequently used Cyrillic characters are used. These are the following characters:

А Б В Г Д Е Ж З И К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ы Ь Ю Я Й

On each Fialka machine, regardless of the country in which it was used, these 30 characters are always at the same position on the keyboard and on the print head. On the international version of the M-125, it is possible to switch between Russian and Latin. For that, two letters are printed on each key top: a Cyrillic one in green and a Latin one in red. The position of the Latin characters varies per country. Numbers were not present on the keyboard and had to be typed in full word.


Cipher wheels


The M-125  uses 10 cipher wheels which have 30 flat-faced electrical contacts and 30 spring-loaded contacts respectively on both sides. Each of the 10 cipher wheels is wired differently and has the number of pins on the outer rim which controls the stepping of the wheel of its neighbour. The number of pins and their position are different on each wheel. Each of the 10 wheels is identified by a letter of the Russian alphabet which is engraved in its right side. 

In principle, all wheels can make a single step in each key-press, but it's stepping can be inhibited by its controlling wheel. Wheel 2 controls the stepping of wheel 4. If a pin is present at a certain position, it inhibits the stepping of wheel 4. For this reason the pins are also known as 'advance blocking pins'. In the same way, wheel 4 controls the stepping of wheel 6, and so on. For the odd wheels, wheel 9 is the driving one. It controls wheel 7 that in turn controls wheel 5, etc.


Card Reader


The M-125-3 has a card reader that adds an extra layer of permutations to the machine. The card reader is located at the left side of the machine and consists of a drawer that gives access to a 30 x 30 contact matrix. In many respects it can be seen as a non-moving programmable wheel. Lower the metal bar that protects the reader and firmly pull out the drawer that holds the card.
As the Fialka uses a reflector, just like Enigma's Umkehrwalze, the current passes the card reader twice. In practice the punched card was part of the daily key and was changed every 24 hours. It was made of paper that was so thin that it easily got ripped, so that it could not be used twice.


Printer


Unlike the WWII German Enigma machine that presented its output on a panel with 26 lamps, the Fialka can print its output directly on a paper strip that could be used directly in a telegram. In addition, the machine could also punch the message into a standard 5-level teleprinter tape.
The Fialka accepts two paper sizes. In addition to the standard 5-level teleprinter tape, it is also possible to print the text on a narrow 10 mm paper tape.


Tape Reader


The M-125-3 has a fully integrated paper-tape reader that accepts standard 5-level teleprinter tape in the specific Fialka encoding standard. It is located at the front right of the machine and is mechanically coupled to the keyboard. It can be used to play back previously created messages.


Counters


The M-125 has a character counter at the front left that is used to count 5-letter groups. The counter is reset by pressing the large push-button at the front of the machine's base. The rightmost digit (marked with a red border) is used to count the characters and wraps around at five (1-5) whilst the remaining 3 digits are used to count the number of 5-letter groups.


Explanation


Although the circuit diagram of the M-125 is very complex, its operating principle is similar to, but more advanced than, the Enigma cipher that was used by the Third Reich during WWII. The extra complexity was added to circumvent certain cryptographic weaknesses of the Enigma.

Let us first consider the above block diagram of the Enigma. It has 26 keys that operate 26 switches. The current from the battery is passed by these keys through the plugboard (German: Steckerbrett) onto a static entry disc (German: Eintrittswalze, or ETW). From the ETW, the current is passed through the cipher wheels until it hits the reflector (German: Umkehrwalze, or UKW). The UKW returns the current back through the wheels, the ETW and the Steckerbrett, after which it arrives at the lamp panel where the lamp of the encoded letter lights up. This is the output.




The operating principle of the M-125 is similar, but the plugboard has been replaced by a card reader that offers a stronger encryption by providing a non-self-reciproke permutation. The keyboard (at the right) is used for the input. It consists of 30 electrical contacts; one for each key. Furthermore, the keys are mechanically encoded into a 5-bit digital code (similar to Baudot). When typing, the current from the 30 contacts is passed to the card reader at the top right.




From the card reader, the current is passed via the static entry disc, through the 10 cipher wheels. After the current arrives at the reflector on the left, it is returned through the 10 wheels, the entry disc and the card reader, until it arrives at the 5-bit encoder (bottom right), where the 30 lines are converted into a 5-bit code (similar to, but different from Baudot) for the printer.


Cracking the Fialka


Cryptanalysis of Fialka was difficult, but not impossible. The ten rotors with 30 character positions each and two ways to slot in the rotor (forwards and backwards) gave a massive number of starting configurations, over 604 quadrillion possibilities! Adding in the later upgrade of a rotor with changeable wirings gives another 403 heptillion, or 403 trillion trillion possibilities. Like in Enigma, the rotors themselves can be rearranged in another ten factorial, or 3.6 million ways. Finally, a day key can be inputted on a punch card that swaps certain letters, functioning like the Enigma’s plugboard. Multiplying, we see that even without the day key, the number of possible starting configurations number in at 8.7 followed by fifty zeroes.

The increasing complexity of electromechanical ciphers using rotor technology had its limitations. Israel captured a machine during the 6 Day War in 1967, and the NSA built a computer to decrypt Fialka traffic fairly easily (Courtois, 2012). The fact was, rotor ciphers became so frequently used that finding a method of cryptanalysis was hardly new territory. Rotor machines and electromechanical ciphers had already begun to reach the end of their usefulness when digital computing delivered the deathblow.


We hope you find this blog insightful and a pleasant read. Please like and share it with your friends and do comment on what more you would like to read!

1 comment: