You get a bonus - 1 coin for daily activity. Now you have 1 coin

Code of Playfera example

Lecture



The Player's Cipher is a hand-held symmetric encryption technique that first used the replacement of bigrams. Invented in 1854 by Charles Wheatstone. The cipher provides for the encryption of pairs of characters (bigrams), instead of single characters, as in the substitution cipher and in more complex Vigener encryption systems. Thus, the Playfer cipher is more resistant to cracking than the simple replacement cipher, as the frequency analysis is hampered. It can be performed, but not for 26 possible characters (the Latin alphabet), but for 26x26 = 676 possible digrams. The analysis of the frequency of bigrams is possible, but is much more difficult and requires a much larger amount of ciphertext.
Encryption
The Playfer cipher uses a 5x5 matrix (for the Latin alphabet, for the Russian alphabet it is necessary to increase the matrix size to 6x6) containing a keyword or phrase. To create a matrix and use a cipher, it is enough to memorize a keyword and four simple rules. To compose a key matrix, you first need to fill the empty cells of the matrix with the letters of the keyword (not writing repeated symbols), then fill the remaining cells of the matrix with alphabet characters that are not found in the keyword, in order (in English texts, the symbol "Q" is usually omitted, to reduce the alphabet, in other versions, "I" and "J" are combined into one cell). The keyword can be written in the top row of the matrix from left to right, or in a spiral from the upper left corner to the center. The keyword, supplemented by the alphabet, constitutes a 5x5 matrix and is the key of the cipher.
In order to encrypt a message, it is necessary to break it into bigrams (groups of two characters), for example, “Hello World” becomes “HE LL OW OR LD”, and to find these digrams in the table. The two digram symbols correspond to the corners of the rectangle in the key matrix. Determine the position of the corners of this rectangle relative to each other. Then, guided by the following 4 rules, we encrypt pairs of characters in the source text:
If the two characters of the bigram match, add after the first character “X”, encrypt the new pair of characters and continue. In some embodiments of the Playfer cipher, “Q” is used instead of “X”.
If the digram characters of the source text are found in one line, then these symbols are replaced by symbols located in the nearest columns to the right of the corresponding symbols. If the character is the last in a string, then it is replaced with the first character of the same string.
If the digram symbols of the source text are found in the same column, they are converted into the symbols of the same column, directly below them. If the character is lower in the column, then it is replaced with the first character of the same column.
If the digram symbols of the source text are in different columns and different lines, then they are replaced with symbols that are in the same lines, but corresponding to the other corners of the rectangle.

To decrypt, you must use the inversion of these four rules, throwing back the characters "X" (or "Q"), if they do not carry the meaning in the original message.
Example
Use the key "Playfair example", then the matrix will look like:

Code of Playfera example

Encrypt the message "Hide the gold in the tree stump"
1. The HI digram forms a rectangle, replacing it with BM.
2. The DE digram is located in one column, replacing it with ND.
3. The TH digram forms a rectangle, replacing it with ZB.
4. The digram EG forms a rectangle, replacing it with XD.
5. The OL digram forms a rectangle, replacing it with KY.
6. The DI digram forms a rectangle, replacing it with BE.
7. The NT digram forms a rectangle, replacing it with JV.
8. The HE digram forms a rectangle, replacing it with DM.
9. The TR digram forms a rectangle, replacing it with UI.
10. The EX digram is in one line, we replace it with XM.
11. The ES digram forms a rectangle, replacing it with MN.
12. The TU biggram is in one line, replacing it with UV.
13. The digram MP forms a rectangle, replacing it with IF.
We get the encrypted text "BM ND ZB XD KY BE JV DM UI XM MN UV IF" Thus the message "Hide the gold in the tree stump" is converted to "BMNDZBXDKYBEJVDMUIX MNUVIF"


Illustrations in examples
Suppose that you need to encrypt the OR digram. Consider 4 cases:

Code of Playfera example

OR is replaced by YZ.

Code of Playfera example

OR is replaced by BY

Code of Playfera example

OR is replaced by ZX

Code of Playfera example

OR is replaced by ZY

created: 2016-09-19
updated: 2021-10-17
132572



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Cryptographic ciphers

Terms: Cryptographic ciphers