1, also known as the chessboard password, is the use of Polybius Phalanx encryption password method, ADFGVX password is the German in the First World War using the block password. In fact, it was an additional version of the earlier cipher ADFGX. In March 1918 Colonel Fritz Nebel invented the code and advocated its use. It combines a modified Polybius grid replacement password with a single-line transposition password. This password is used to name six letters A, D, F, G, V, x in the ciphertext. ADFGVX was cracked by the French Army Lieutenant Georges Painvin. In the classical cryptography standard, this password cracking work is particularly difficult, during this period, Painvin more health suffered serious damage. His solution is to rely on finding multiple copies of the same message, which means that they are encrypted by the same decomposition key and SHIFT key.
2. Fill the Polybius phalanx with an intricate set of alphabets
Fig. 1 Polybius Phalanx
In the Phalanx, I and J are considered the same character, so that the number of letters conforms to the 5*5 lattice.
3, why Choose ADFGX?
|: They are not easily confused when they are translated into Morse code, which reduces the chance of transmission errors.
|| : Use this square to find out where the clear letter is in this square, and then replace the letter with the column name and the name that contains the letter.
4、示例: 加密时可以在表格中找到明文,然后使用明文所在的行字符和列字符代替,比如明文为g,则密文为GA,明文为a,则密文为
Af. Decryption can only be found in the password table in the corresponding characters of the column to be decrypted, such as ciphertext for AFAD, the plaintext is at, for example, ciphertext is the XF, the plaintext is E
PlainText: a T t a C K a T O N c E
Redaction: AF AD AD af GF DX AF ad DF FX GF XF
5, the algorithm implementation:
There are two ways to implement this method: (1) Full use substitution (2) using a For loop to determine
(1) Full use of alternative methods
You can replace the 25 letters in the table with the ReplaceAll () function, and use the same action when decrypting
(2) Use for loop to determine
First, define a two-dimensional array, used to save the password table, set to Biao[6][6], and then write the characters into the table, and then convert the user input plaintext into a character array str_p[], the clear text is traversed, using the criteria to judge the character, if str_p[k]== BIAO[I][J], then str_c[n++]=biao[i][0]+biao[0][j], loop to encrypt all plaintext
In the decryption, you can cycle judgment biao[i][0]==str_c[k]&&str_c[k+1]==biao[0][j], if equal, then make str_p[m++]=biao[i][j], so that the addition of decryption.
6, plus decryption Demo:
Figure 1 What to encrypt
Figure 2 What is encrypted
Figure 3 post-restore content
The above is the implementation of Polybius plus decryption.
Information Security encryption Technology--polybius password