Cryptography Popular Science|Those Incredible Classical Cryptography
PlatON云图
2021-03-30 10:40
本文约3533字,阅读全文需要约14分钟
PlatON introduces you to cryptography.


Author | PlatON Technical Preparatory Group Silas

Picture source | Unsplash


Cryptography is a subject that encrypts information, processes and transmits it, and analyzes encrypted information. According to the emergence of the public key encryption system represented by RSA, the development process of cryptography can be divided into two parts: classical cryptography and modern cryptography. Classical cryptography is based on the "replacement method" and "replacement method", and is mostly used in the military and intelligence fields; modern cryptography is based on mathematics, computer and communication science. In addition to encrypting information, digital signatures, data Integrity, identity authentication, etc. are also research topics of modern cryptography.

andandModern cryptographyThe main difference lies in the use of computers. Generally speaking, classical cryptography is based on characters, while modern cryptography is based on binary bits.

The concept of cryptography is not the same as the "password" that people usually use to log in to websites and use bank accounts. These "passwords" for authentication, more accurately translated as passwords, are one of the many applications of modern cryptography.

Generally speaking, classical cryptography mainly includes two categories, namely substitution and permutation.

The substitution method changes the order of letters in the original information according to certain rules; the substitution method replaces the letters in the original information with other letters according to certain rules. The security of permutation method and substitution method is poor, and the ancient Arab scholars created the science of deciphering encrypted information——cryptanalysis, and cracked the replacement encryption method through the method of frequency analysis.

replace

The substitution password is to replace the characters in the plaintext with other characters, that is,substitution conversion, if each character is replaced by the same table during the entire encryption process, it issingle table substitution cipher, similarly, if each character is replaced by a different table during the entire encryption process, it isMulti-table substitution cipherfirst level title

caesar cipher


Caesar cipher (Caesar cipher) is to replace all letters in the plaintext with a fixed number of offsets backward (or forward) in the alphabet and then replaced with ciphertext. For example, when the offset is 3, all letters A will be replaced with D, B becomes E, and so on. The encryption process of the plaintext Hello World is as follows:

  • Take an offset of 3

  • and so on

  • and so on

  • The ciphertext is: Khoor Zruog

Similarly, the decryption process is as follows:

  • and so on

  • and so on

  • The plain text is: Hello World

first level title

bacon cipher

When Bacon's cipher is encrypted, each letter in the plaintext will be converted into a set of 5 English letters. Its conversion depends on the following table:

According to the above table, the ciphertext of the plaintext hello is AABBBBAABAAABABBABABBBABBBA. Obviously, the length of the ciphertext is 5 times the length of the plaintext. In addition to the above table used to encrypt lowercase plaintext, there is also a table used to encrypt uppercase plaintext.

first level title

Virginia code

The Virginia cipher is an encryption algorithm that uses a series of Caesar ciphers to form a cipher alphabet.

This table consists of 26 rows of the alphabet, each row shifted to the left by 1 bit from the previous row. Rows are plaintext rows, columns are key columns, and ciphertext is in the table. The encryption result of the plaintext HELLOWORLD is as follows:

  • Select a keyword as the key, such as SECRET

  • For the first letter H of the plaintext, it corresponds to the first letter S of the key, so use the S row alphabet in the table to encrypt to get the first letter Z of the ciphertext

  • By analogy, if the length of the key is less than the length of the plaintext, go to the first letter of the key and continue to loop, and finally get the ciphertext ZINCSPGVNU

Similarly, the decryption process is as follows:

  • According to the S-row alphabet corresponding to the first letter S of the key, it is found that the first letter Z of the ciphertext is located in the H column, so the first letter of the plaintext is H

  • And so on

first level title

replacement

first level title

fence password


Rail fence cipher, also known as fence cipher, is to divide the plaintext to be encrypted into n groups, and then connect the first word of each group, and then connect the second word of each group, By analogy, an irregular sentence is formed. The encryption process of the plaintext Hello World is as follows:

  • Remove spaces: HelloWorld

  • A group of 5: Hello, World

  • Take out the first letter of each group: HW

  • and so on

  • and so on

  • Linked together: HWeolrllod

  • Add appropriate spaces: HWeol rllod

Similarly, the decryption process is as follows:

  • Remove spaces: HWeolrllod

  • Divided into 5 columns: HW, eo, lr, ll, od

  • Take out the first letter of each column: Hello

  • And so on

  • Linked together: HelloWorld

  • Add appropriate spaces: Hello World

first level title

other

pawn shop password

first level title

Pigpen password


Pigpen cipher, also known as Masonic cipher, is a simple substitutional cipher based on lattices. The figure below shows the correspondence between the symbols used in the pigsty cipher and the 26 English letters:

The encryption result of plaintext X MARKS THE SPOT is as follows:

For more than a thousand years, classical cryptography has continued to evolve based on permutation and substitution methods. The multi-alphabet substitution encryption method represented by the Virginia cipher uses multiple different substitution cipher tables in turn to encrypt the letters in the plaintext in turn. The "Enigma" used by the German army during World War II is a mechanical cipher machine based on the principle of complex multi-table replacement encryption, but in the end due to the flaws in its own encryption algorithm, it was overcome by the "bomb" designed by Turing .

Hugh Whitemore's play Breaking the Code follows the life of Alan Turing, who helped Britain break the code for the Enigma machine during World War II.

The 1996 novel "Enigma" by British best-selling author Robert Harris tells the story of the cryptographers at Bletchley Park who deciphered Enigma. In 2001, this novel was made into a movie "Enigma".

The 2000 film U-571, by Jonathan Mostow, is about a group of American submariners who take over a German submarine in order to capture an Enigma machine. The Enigma machine in the movie is the real thing in the hands of a collector. The plot of this movie does not strictly follow the historical development. The British Royal Navy defeated the German submarine U-110 in 1941 and was the first to obtain the German Navy cipher machine. It is also the real version of the movie hunting U-571. A U-boat was captured before landing.

The movie "The Imitation Game" released in 2014 tells the story of Alan Turing and other British mathematicians and logicians assisting the military in deciphering the Enigma cipher machine.

In 2019, NetEase launched an asymmetric anti-suspense mobile game "Fifth Personality". The survivors need to decipher five cipher machines to power on the gate and enter the code to escape. The five cipher machines that need to be deciphered are the Enigma cipher machines.

The weakness of permutation and substitution encryption is that it fails to completely eliminate some features of the plaintext in the ciphertext, and retains some information in the plaintext. Kerckhoff's Principle proposed by August Kerckhoff in the 19th century (Kerckhoff's Principle) generally summarizes the design principles that encryption algorithms should follow: even if all aspects of the encryption system are public knowledge (Public knowledge) , as long as the key is not leaked, the encryption system should be secure.

The essence of the security problem of the encryption algorithm is: how to reduce the possibility of the attacker guessing the correct key on the premise of knowing the encryption algorithm and having a sufficiently long ciphertext fragment?

In 1948, Shannon founded information theory, and discussed encryption systems from a mathematical perspective in a paper the following year, and people began to explore the mysteries of cryptography from a scientific perspective.


Welcome to join the PlatON Network technology research community

Discord Developer Community

https://discord.com/invite/jAjFzJ3Cff


Reference:

[1] https://howiezhao.github.io/2018/08/10/classical-crypto/

[2] https://www.chainnews.com/articles/577594859080.htm

[3] The Code Book, Simon Singh (1999)

[4] The Code Breakers, David Kahn (1996)

[5] https://en.wikipedia.org/wiki/Enigma_machine


PlatON云图
作者文库