Who came up with a cipher with permutation of letters. Vertical permutation cipher. Simple permutation ciphers

Story

Exact time the appearance of the permutation cipher is not known. It is quite possible that scribes in ancient times rearranged the letters in the name of their king in order to hide his true name or for ritual purposes.

One of the oldest encryption devices known to us is Scytala. It is undoubtedly known that the wanderer was used in the war of Sparta against Athens at the end of the 5th century BC. e.

The ancestor of the anagram is considered to be the poet and grammarian Lycophron, who lived in Ancient Greece in the 3rd century BC e. As the Byzantine author John Tsets reported, from the name of King Ptolemy he composed the first anagram known to us: Ptolemaios - Aro Melitos, which translated means “from honey”, and from the name of Queen Arsinoe - as “ Ion Eras"(violet of Hera).

Simple permutation ciphers

Typically, when encrypting and decrypting a simple permutation cipher, a permutation table is used:

1 (\displaystyle 1) 2 (\displaystyle 2) 3 (\displaystyle 3) ... n (\displaystyle n)
I 1 (\displaystyle I_(1)) I 2 (\displaystyle I_(2)) I 3 (\displaystyle I_(3)) ... I n (\displaystyle I_(n))

The first line is the position of the character in the plaintext, the second line is the position in the ciphergram. Thus, with message length n (\displaystyle n) characters exist exactly n! (\displaystyle n!\ ) keys.

Ciphers route rearrangement

The so-called route permutations using some geometric figure(flat or volumetric). The transformations consist in the fact that a segment of plaintext is written into such a figure along a certain trajectory, and written out along a different trajectory. An example of this cipher is the Scytala cipher.

Table routing permutation cipher

The most widespread routing codes permutations based on rectangles (tables). For example, you can write a message in a rectangular table along the route: horizontally, starting from the upper left corner, alternately from left to right. We will copy the message along the route: vertically, starting from the upper right corner, alternately from top to bottom.

P R And m e
R m A R w
R at T n O
th P e R e
With T A n O
V To And

CRYPTOGRAM: yesoeomrnrniateairmuptkprrysv

Reversing the steps described will not present any difficulty in deciphering.

Cipher vertical rearrangement

A type of route permutation - vertical permutation - has become widespread. This cipher also uses a rectangular table in which the message is written in rows from left to right. The ciphergram is written vertically, with the columns selected in the order determined by the key.

CLEAR TEXT: example of route permutation

KEY: (3, 1, 4, 2, 5)

P R And m e
R m A R w
R at T n O
th P e R e
With T A n O
V To And

CRYPTOGRAM: rmuptkmrnrnrnprrysviateaeshoeo

Fill last line tables with “non-working” letters is impractical, since the cryptanalyst who received this cryptogram receives information about the length of the numeric key.

Code "rotary grid"

In 1550, the Italian mathematician Gerolamo Cardano (1501-1576) proposed in his book On Subtleties new technology message encryption - lattice.

Initially, the Cardano lattice was a stencil with holes into which letters, syllables or words of a message were written. Then the stencil was removed, and free place filled with more or less meaningful text. This method of hiding information refers to steganography.

Later, the “rotating lattice” cipher was proposed - the first transpositional (geometric) cipher. Even though there is a big difference Between Cardano's original proposal and the rotating lattice cipher, stencil-based encryption methods are commonly called "Cardano lattice".

To encrypt and decrypt using this cipher, a stencil with cut out cells is made. When applying a stencil to a table of the same size with four possible ways, its cuts must completely cover all the cells of the table exactly once.

When encrypting, a stencil is placed on the table. Letters of plaintext are written into visible cells along a certain route. Next, the stencil is turned over three times, each time performing the filling operation.

The ciphergram is written out from the resulting table along a specific route. The key is the stencil, the route of inscription and the order of turns.

This method encryption used for transmission classified information Dutch rulers in the 1740s. During World War I, Kaiser Wilhelm's army used the "rotating grid" cipher. The Germans used bars different sizes, however, for a very short time (four months), to the great disappointment of the French cryptanalysts, who had just begun to select the keys to them. For grids of different sizes, the French came up with their own code names: Anna (25 letters), Bertha (36 letters), Dora (64 letters) and Emile (81 letters).

Block ciphers

Due to plaintext Since the message usually has an arbitrary length, sometimes quite large, it is divided into smaller blocks of a fixed length. The texts of these blocks are encrypted separately and independently of each other.

Single-key block ciphers are divided into 3 groups:

Permutation ciphers

Substitution ciphers

Composite ciphers.

When using permutation ciphers, which are designed to eliminate the meaning of a message by changing the order of alternation of its symbols, the plaintext characters are rearranged according to a certain rule (key) within a given block. As a result of this, the normal order of their occurrence and the very meaning of the information message are disrupted. In this case, a distinction is made between simple and complex permutation ciphers.

A simple permutation cipher rearranges a group of letters of text in a regular manner according to a chosen permutation key (rule). There are many examples from history of the use of such ciphers for manual encryption. In this case, special tables were often used, which provided simple encryption procedures (keys), according to which the letters in the message were rearranged. The key for such tables was the size of the table, a phrase specifying a permutation or other special features of the table.

An example of the simplest permutation cipher is shown in Fig. 5.5.

Rice. 5.5. The simplest cipher permutations.

As can be seen from Fig. 5.5, in order to encrypt the message “YUSTACE ALEX MEET YOUR CONNECTED MAN”, the latter must be written in the form of a table consisting, for example, of 5 rows and 6 columns. The message text is written in columns, excluding spaces. If the last column is incomplete, it is filled randomly with any letters. To obtain an encrypted message, the original text is read line by line (from left to right) and written in groups, for example, 5 digits. Last

the procedure does not relate to the encryption process and is done only to make it more convenient to write down text that is devoid of any meaning. To decrypt such text, you need to know the key, namely the number of rows and columns in the table or, in other words, its size.

A more practical encryption method, very similar to the previous one, is described below. It differs only in that the table columns are rearranged according to keyword, a phrase or a set of numbers the length of a table line.

When encrypting by simple permutation, the ciphertext is written in successive lines under the keyword symbols, which should not be repeated. To simplify the remembering of the key, a keyword is used, the letters of which, numbered in the order of their location in the alphabet, set the permutation rule. The ciphertext is written out in columns in the sequence in which the letters of the key are located in the alphabet or in the order of numbers in a natural series, if the key is digital. The encryption process using a simple permutation cipher is illustrated in Fig. 5.6. Suppose you need to encrypt an information message



“THE MEETING WILL BE HELD TOMORROW JUSTACE.”

To encrypt this plaintext, we write it without spaces (the participation of the latter in the encryption procedure, due to their high frequency repetition, significantly weakens the cryptographic strength of the cipher) and choose an encryption key, for example, 245 136. According to this key, consisting of 6 digits, we will divide the entire information message into blocks, each of which will contain 6 letters of text. After dividing into blocks, we got 4 blocks containing 6 letters each, and 1 block containing 5 letters. In such cases, the last group of letters original message randomly supplemented with various symbols until a complete block is obtained. In our case, only one letter is missing, so we select any letter, for example Ъ, and add it at the end of the fifth block.

Rice. 5.6. Simple permutation cipher

Next, using the key 245 136, the letters of the original plaintext are rearranged. For example, the first digit of the key is 2, indicating that in the new block the first letter of the ciphertext will be the second letter of the plaintext block, the second digit of the key is 4, indicating that the second letter of the ciphertext is the fourth letter in the plaintext block, etc. d.

Ultimately, after permutations in all blocks, we obtain ciphertext. Having read it, we see that it is completely devoid of any semantic content.

To make the key easier to remember, a keyword is usually used. IN in this case- this is the word “ROOT”. In it, number 1 of the key corresponds to the letter E, since it is the first of all letters of this word found in our alphabet, number 2 - the letter K (for the same reason), etc.

The same message can be encrypted using a table consisting of, for example, 5 rows and 6 columns (the length of the keyword). The source text is written in columns and forms a table (Fig. 5.7). The keyword specifies a rule for rearranging columns. If the same letters appear in a keyword, they are numbered in order from left to right. The resulting second ciphertext, as can be seen from Fig. 5.7 is completely different from the first one.

Rice. 5.7. Encryption using a table

The main disadvantage of this cipher is its low cryptographic strength. By factoring the ciphertext (there aren't many options), you can easily determine the likely length of the codeword that was used during encryption.

To increase the cryptographic strength of the ciphertext obtained above, you can try to encrypt it again. This encryption method is known as double permutation. The essence of this method is as follows. The text obtained after the first encryption is encrypted a second time using a table with a different dimension (the lengths of the rows and columns are selected differently). In addition, you can rearrange rows in one table and columns in another. You can fill the table with source text different ways: zigzag, snake, spiral, etc.

A simple permutation cipher using table properties called magic squares (Figure 5.8) has been used since the Middle Ages. Magic squares are equilateral tables in which all cells are filled natural numbers, starting from 1. Moreover, these numbers in sum give the same number for each column, each row and diagonals of the magic square (in our case, this is the number 34). Source text - WAITING TO MEET YOU JUSTACE, when filling out the magic square, it is entered in the order of the natural numbers, for example, the number 1 was replaced by 1 letter source text(G), number 12 - 12 letter of the message (C), etc. After writing the plaintext, the contents of the table are read line by line, resulting in a ciphertext with permutation of letters.

Rice. 5.8. Magic square

Permutation ciphers

This method consists in the fact that the characters of the encrypted text are rearranged according to certain rules within the encrypted block of characters, i.e. transformations lead to a change only in the order of the characters in the original message. Let's look at some of the most common varieties of this method - simple, table-complicated, and route-complex permutations.

Encryption simple rearrangement (vertical rearrangement) is carried out as follows:

1) a keyword with non-repeating characters is selected;

2) the encrypted text is written in consecutive lines under the keyword symbols;

3) the ciphertext is written out in columns in the sequence in which the letters of the key are located in the alphabet (or in the order of numbers in a natural series, if the key is digital).

As an illustration, here is an example of encryption using a simple rearrangement of the message: “BE CAREFUL WITH YOUR REPRESENTATIVE OF THE PHOENIX COMPANY.” In this case we apply digital key 5 – 8 – 1 – 3 – 7 – 4 – 6 – 2. In the source text, a letter is used instead of spaces A.

B U D b T E A ABOUT
WITH T ABOUT R ABOUT AND N Y
A WITH A P R E D WITH
T A IN AND T E L E
M A F AND R M Y A
F E N AND TO WITH A A

By writing the text in columns and grouping characters by five, we get the encrypted text in the form:

DO VF NOYSE LRP IIEZH EEMSB S TMF NDLY TOPT RKUTS A E .

Decryption is performed in the following order:

1) count the number of characters in the ciphertext and divide by the number of characters in the key;

2) write down the keyword and under its signs in the appropriate sequence write down the ciphertext symbols in the quantity determined above;

3) read the source text according to the rows of the table.

The number of keys is no more than m!, where m is the number of table columns.

The weakness of encryption by simple permutation is due to the fact that with a large length of the encrypted text, patterns of key symbols may appear in the ciphertext. To eliminate this drawback, you can change the key after encrypting a certain number of characters. By changing the key frequently enough, the strength of encryption can be significantly increased. At the same time, however, the organization of the encryption and decryption process becomes more complicated.

To obtain and remember a numeric key, there are various methods. One of the most common is to assign numbers to letters according to alphabetical order letters Let's take, for example, the word PERMANENT. The letter A present in it receives No. 1. If a letter appears more than once, its occurrences are numbered sequentially from left to right. Therefore, the second occurrence of the letter A gets #2. There is no letter B in this word, then the letter B receives No. 3, etc.:

P E R E WITH T A N ABOUT IN TO A

Complicating the rearrangement of the table lies in the fact that to record the characters of the encrypted text, a special table is used, into which some complicating elements are introduced. The complication is that a certain number of table cells are not used (they are empty in the figure). The number and location of unused elements is additional key encryption. Encrypted text in blocks of m x n – s elements (m x ntable dimensions, s– number of unused elements) is recorded in the table. Further encryption is similar to simple permutation.

B U D b T E A ABOUT WITH
T ABOUT R ABOUT AND N Y A
WITH A ABOUT R E D WITH T A
IN AND T E L E M A F
AND R M Y A F E N AND
TO WITH A A A A A A A

The encrypted text will look like this: DOPR BSWIK RRTM OY N ENSEF UT I SS AF I HOE EE T ME TJ DL.

During decryption, the ciphertext characters are written in table columns in a sequence of key characters, skipping unused elements. The source text is read line by line. By varying the size of the table, the sequence of key characters, and the number and location of unused elements, you can obtain the required strength of the ciphertext.

Another option is cipher "Rotating grid" . intended for messages of length 4mk. Take a stencil measuring 2m*2k cells, cut out m*k cells so that when applied to a sheet of paper of the same size 4 different ways(rotating 90°) its cutouts completely cover the entire area of ​​the sheet. The letters of the message are sequentially entered into the stencil cutouts line by line, in each line from left to right, for each of its 4 possible positions in advance in the prescribed manner. The number of possible stencils, i.e. the number of keys of this cipher is 4 mk (with a stencil size of 8*8, the number of options exceeds 4 billion).

Very high encryption strength can be achieved complicating rearrangements along routes like Hamiltonian ones. In this case, the vertices of a certain hypercube are used to record the characters of the ciphertext, and the characters of the ciphertext are read along Hamilton routes, and several different routes are used. For example, consider encryption using Hamilton routes with n = 3. The structure and three routes are shown in Fig. 7, and an example of encryption is in Fig. 8.

Substitution (replacement) ciphers are based on an algebraic operation called substitution. A permutation is a one-to-one mapping of a finite set M onto itself. The number N of elements of sets is called the degree of substitution. The number n of numbers actually moved by substitution is called the length of the substitution cycle.

Permutation ciphers is a cipher, the conversion from which is changed only order of occurrence characters of the source text, but do not change them themselves.

Weakness of replacement ciphers. If in open message If a symbol occurs frequently, then the corresponding symbol appears with the same frequency in the encrypted message. For large amounts of text, this leads to successful cryptanalysis. Thus, it is impossible to encrypt sufficiently long messages using one key.

Networks (as an element of encryption) - any block cipher is a combination of the first two schemes. Using the concept of "network" in block encryption consists in repeated repetition of the original operations (repetitions are cycles or rounds, and the operations themselves are layers). Some of the layers may contain keys. This allows:

  1. Make the cipher easily complicated (by increasing the number of rounds)
  2. Cut down to size program code
  3. Unify the algorithmic encryption formula

The Feisil network (Feistel) is a method of constructing an encryption cycle in iterative encryption algorithms based on a shift register, with a feedback function depending on the round key (the optimal number of rounds is from 8 to 32)

DES – US federal encryption standard (1997-2001).

Architecture – classical, balanced Faisil network with initial and final bit permutations general view. The key size is 56 bits. Based on it - international standard ISO 8372-87. The algorithm is designed to encrypt data in 64-bit blocks.

DES is a combination of two main methods:

  1. Substitution
  2. Rearrangement.

A single combination of these two methods is applied to the text.



DES has 16 rounds, meaning the same combination of methods is applied to the plaintext 16 times.

The key round is applied using the XOR operation

Source text=>Initial permutation=>Encryption * 16(<=Ключ) =>Final permutation => ciphertext

The purpose of the initial permutation is to evenly distribute adjacent bits across blocks.

The same function can be used to encrypt and decrypt, but the keys are used in reverse order.

DES provides 4 types of operation:

  1. ECB-electronic cipher pad. Plaintext is processed in 64-bit blocks, encrypted with one key
  2. CBC - block chain. Eliminates the disadvantage of the first mode. The input value of the encryption algorithm is set equal to the XOR difference between the current plaintext block and the ciphertext block obtained at the previous step. Thus, all blocks of the original text are connected (text=>ciphertext=>XOR=>text=>ciphertext)
  3. CFB – ciphertext feedback. The algorithm is converted into a stream cipher, that is, each character can be encrypted and immediately transmitted to the recipient
  4. OFB – output feedback. A portion of the ciphertext is fed into the shift register. For each encryption session, a new initial state of the register is used.

Four modes are believed to be sufficient to use DES in almost any area for which the algorithm is suitable

Hardware implementation of the algorithm on a separate chip makes it possible to achieve high speed encryption with small device dimensions.

AES is the US federal encryption standard currently in use.

AES is an advanced encryption standard.

Requirements:

  1. The cipher must be block
  2. The cipher must have a block length of 128 bits
  3. The cipher must support keys of length 128, 192, 256 bits

The algorithm is unconventional block cipher, since it does not use the Feishtel network for crypto conversions.

The algorithm represents each block of encoded data as two-dimensional array bytes of size 4x4, 4x6 or 4x8 depending on the set block length.

The algorithm consists of a certain number of rounds (from 10 to 14 - this depends on the block size and key length).

GOST 28147089 – Russian standard for data encryption and data protection.

The algorithm is designed for hardware and software implementation, satisfies the necessary cryptographic requirements and does not impose restrictions on the degree of secrecy of the protected information.

The algorithm implements encryption of 64-bit data blocks using a 256-bit key consisting of eight 32-bit subkeys.

On every i-th round The K i th connector is used.

GOST 28147-89 encryption algorithms have the advantages of other algorithms for symmetric systems and surpass them in their capabilities.

At each i-th round of the GOST algorithm, following operations:

L i =R i -1 , R i =L i -1 (plus circle)f(R i -1 , K i)

After completing these 32 operations, the implementation of the encryption algorithm will be completed.

The advantage of GOST is the presence of protection against the imposition of false data (imitation insertion mode), as well as the same encryption cycle in all 4 modes (algorithms) of GOST.

High cryptographic strength is ensured due to the large key length (256 bits) and 32 conversion rounds.

The standard includes modes (algorithms):

  1. Easy replacement mode
  2. Gamma mode
  3. Gamma mode with feedback
  4. Simulation insert generation mode

Asymmetric encryption algorithms.

In asymmetric encryption algorithms (or cryptography with public key) one key (public) is used for encrypted information, and another (secret) is used for decryption

These keys are different and cannot be derived from each other.

Information exchange scheme:

  1. The recipient calculates the public and secret keys; the secret key is kept secret, but the public key is made available (informs the sender, a group of network users, publishes)
  2. The sender, using the recipient's public key, encrypts the message that is sent to the recipient
  3. The recipient receives the message and decrypts it using his private key

Usage asymmetric method encryption

The use of such ciphers became possible thanks to K. Shannon, who proposed constructing a cipher in such a way that its solution was equivalent to solving mathematical problem, requiring volumes of calculations that exceed the capabilities of modern computers(for example, operations with large prime numbers and their products; finding the value of the product P=x*y)

RSA data encryption cryptosystem.

Currently the most developed method cryptographic protection information with a known key is RSA, named after the initial letters of the names of its inventors (Rivest, Shamir, Adleman)

To use RSA algorithms, you must first generate the public and private keys by running next steps:

  1. Choose two very large ones prime numbers p and q and define n as the result of multiplying p by q (n=p*q)
  2. Select large random number d. This number must be coprime to m, the result of multiplication (p-1)(q-1)
  3. Determine a number e for which the following relation is true (e*d)mod(m)=1 or e=(1mod(m))/d
  4. The public key will be numbers e,n, and the secret key is numbers d,n

Key creation is highlighted in red.

Asymmetric cryptosystems based on elliptic curves.

On the basis of elliptic curves E, it is possible to implement not only cryptoalgorithms asymmetric encryption, but also the development of general secret key for symmetric encryption.

Cryptosystems based on elliptic curves make it possible to use significantly smaller sizes keys compared to other cryptographic algorithms while maintaining the same level of cryptographic strength.

For the above implementations, elliptic curves over Galois fields GF(p) with a finite number p of elements of two types are used:

  1. Elliptic curve over a finite field of type E(GF(p)), where p is some prime number
  2. Elliptic curve over a finite field of type E(GF(2m)), where p=2m

Example: Asymmetric encryption algorithm based on elliptic curves ECES (Elliptic Curve Encryption Scheme)

ElGamal algorithm.

The ElGamal system is a public key cryptosystem based on the logarithm problem. This algorithm used for both encryption and digital signature.

The set of system parameters includes a prime number p and an integer g, the powers of which, modulo p, generate big number elements Z p

Replacement methods.

A substitution cipher replaces some characters with others, but preserves their order in the message.

4 types of replacement (substitution):

  1. Monoalphabetic. Formula = Y i =k 1 X i +k 2 (modN), where Y i is the i-character of the alphabet, k 1, k 2 are constants, X i is the i-character of the plaintext, N is the length of the alphabet used.

Example. Replacement - plaintext, Key - Key

  1. Homophonic substitution - substitution of one plaintext character matches several ciphertext characters. This method is used to distort statistical properties ciphertext. Table substitution is used. The values ​​are used one by one from the column.
  1. Polyalphabetic substitution is the use of several alphabets. The alphabet changes at every encryption step. A stepwise replacement of letters according to the table is used.
  2. Polygram replacement - formed from one alphabet using special rules. The cipher is located in a matrix, and the plaintext is divided into pairs of symbols XiXi+1

Permutation ciphers.

The difference between a permutation cipher is that only the order of characters of similar text is changed, but they themselves are not changed.

Example. Text "Load oranges in barrels Brothers Karamazov"

Ciphertext “Ptr_aezguionl_byseit_kramchaizryamaak_a__v____oy”

Simple rearrangement without a key is one of the most simple methods encryption. The letters are mixed according to some rules, but these rules can be different - both simple and complex.

Transposition

Let's say we have a phrase: “IT IS POSSIBLE, BUT NOT”. And we want to encrypt it. The easiest way is to write the entire phrase backwards: “HE IS VICIOUS, ONJOM”. You can leave the order of words in the sentence as original, but write each word backwards: "ONJOM, HE'S VICIOUS". Or you can swap places every two letters: "OMNZH,UNENLYAZ". This is called "transposition" or simple rearrangement in its purest form.

Transpose

This cipher uses a table. The message is written into the table in rows and read in columns to form the ciphertext. Well, or vice versa - it is written in columns and read in rows. We seem to turn the table over with respect to its diagonal, passing through the upper left and lower right corners. Mathematicians call this method of reversing a table transposition.

To encrypt you need to draw suitable size table, enter the encrypted text there line by line, and then write it out in columns in one line. To decrypt, you only need to provide the encryption key in the form of the table size. The picture below is from ABCDEFGHIJKL it turns out ADGJBEHKCFIL. Agree, it is almost impossible to understand without a picture that it was an alphabet.

So, for example, we need to encrypt the text “I erected a monument to myself, not made by hands; the people’s path to it will not be overgrown.” . It has 72 characters. 72 is a convenient number, it is divisible by 2,4,6,8,12,18,24,36, so you can use tables 2x36, 3x24, 4x18, 6x12, 8x9, 9x8, 12x6, 18x4, 24x3, 36x2: ). We decide on the key (table size), enter the text in rows, and then rewrite it in columns.

The picture above shows options with tables 9x8, 8x9, 4x18 and 18x4. For the third option (table 4×18) you will get the following text:

“Yamievvnkoy u atrar yakboieor, n zs oyaopt ezgrtn enatnd pans d uvykmeryoanta (4:18)»

In this case, I took the text “as is,” that is, with spaces between words and punctuation marks. But if the text is meaningful, then punctuation marks and spaces between words may not be used.

Fence

A simplified version of transposition (with a two-line table) is “picket fence”. “In design,” it resembles a checkerboard fence.

This is a very simple encryption method, often used by schoolchildren. The phrase is written in two lines: odd letters are written on the top, even letters on the bottom. Then you need to write out the contract first top line, then the bottom one. This encryption can be easily done in your head, without first writing out two lines.

“I erected a monument to myself, not made by hands” turns into “YAYANKEEODINRKTONY PMTISBVZVGEUOVRY.”

Skitala

It is known that in the 5th century BC, the rulers of Sparta, the most warlike of the Greek states, had a well-developed system of secret military communications and encrypted their messages using the “skalta,” the first simple cryptographic device that implemented the method of simple permutation.

Encryption was performed as follows. A strip of parchment was wound in a spiral (turn to turn) on a cylindrical rod, which was called a “skitala,” and several lines of message text were written on it along the rod. Then a strip of parchment with written text was removed from the rod. The letters on this strip turned out to be located chaotically. To restore the text, a wanderer of the same diameter was required.

Essentially, a scytale is our ordinary flat table wrapped around a cylinder.

It is believed that the author of the method of breaking the cipher of the wanderer is Aristotle, who wound the tape on a cone-shaped stick until readable pieces of text appeared. Initially, the ancient device was used to store secret recipes. Now, instead of a narrow strip of parchment, you can use serpentine, and the role of the wanderer will be played by a pencil.

Shift

A similar result can be obtained if the letters of the message are written through a certain number of positions until all the text is exhausted. Below is an example of a finished puzzle compiled according to these rules. “Three fraction four” is a hint that three words are encrypted, you need to read every fourth letter (4-8-12-16-..), when you reach the end, go back to the beginning with a shift of 1 letter to the left (3-7- 11-15-..), etc. The picture below says “Go along the designated route.”

Single permutation by key

A more practical encryption method called single key permutation is very similar to the previous one. It differs only in that the table columns are not shifted, but rearranged according to a keyword, phrase or set of numbers the length of a table line. The coded phrase is written into a suitable table line by line. Then above the table is inserted empty line and a keyword/phrase/sequence of numbers fits into it. This keyword/phrase/sequence is then sorted by alphabet/meaning and the columns are sorted along with it, thereby shuffling the entire table. The encrypted phrase is then written out row by row from this shuffled table.

For example, you can make a puzzle based on Sudoku. The solver is given the text “-UROMKULO BUYOZEBYADL NZYATLYA TSBADNEPU EMMDNITOYO ICHTYUKNOO UNYYVYCHOS HIEPOTODTs PRMGOUIK-” and is asked to solve a Sudoku in which one of the lines is marked.

You will have to solve this puzzle like this: first you need to write the text in a 9x9 table, then solve Sudoku, draw an empty 9x9 table, write a key line from the marked line above it, and then enter columns in the table under numbers according to their serial numbers in the original table.

For children, you can use the same method, but simpler, even without numbers, and immediately draw the order of permutation in the form of paths.

Double permutation

For added security, you can re-encrypt a message that has already been encrypted. This method is known as "double permutation". To do this, the size of the second table is selected so that the lengths of its rows and columns are not the same as in the first table. It is best if they are relatively prime. In addition, the columns in the first table can be rearranged, and the rows in the second table.

Route rearrangement

The usual transposition of a table (fill in rows, read in columns) can be complicated and read not by columns, but in a snake, zigzag, spiral or some other way, i.e. set a table traversal route. Such methods of filling out the table, if they do not increase the strength of the cipher, then make the encryption process much more entertaining. True, the decryption process becomes more complicated, especially if the route is unknown and still needs to be found out.

In the figure above, the sequence of characters “ABVGDEYEZHZIYKLMNOPRSTUFHTSCHSHSHSHCHYYYYUYA.,?” entered line by line into a 6x6 table and then read out along the route indicated by the lines. The following encryptions are obtained:

    AYOLSCHEBZHMTSHYUVZNUSHYAGIOF.DYPKHY, EKRTS?

    AYOLSCHEYUYA,

    ABELZHVGZMSCHTNIDEYOUSHEYUSHFPKRHYA.YTS,?

    AYOLSCHEYUSHTMZHBVZNUSHYA.ЪFOIGDYPKHY,?BTsRKE

    NZVBAYOZHMLSTSHCHEYUSCHUF.,?YHTSRPYKEDGIO

And here you need to go around the table “with a knight’s move”, and the route has already been drawn, so this is just for little ones :)

But if you present this puzzle as shown below, then it will not be at all easy, since there can be many options for moving around the knight, and you will need to find the only correct one from all these options.

Encrypted “Pushkin. Bronze Horseman".

Permutation "Magic Square"

Magic (or magic) squares are square tables with consecutive natural numbers from 1 to n 2 (where n is the dimension of the square) inscribed in their cells, which add up to the same number for each column, each row and each diagonal.

In the Lo-Shu square of the third order (3×3), known back in Ancient China, the square constant 15 is repeated 8 times:

    along three horizontal lines: 2+9+4 = 7+5+3 = 6+1+8 = 15

    along three verticals: 2+7+6 = 9+5+1 = 4+3+8 = 15

    along two diagonals: 2+5+8 = 4+5+6 = 15

By the way, the constant of an odd square can be easily calculated by multiplying the average number of the series from which the square is made by the order of the square. For a 3rd order square (3×3) the constant is 1234 5 6789 *3=15.

Next, in order to encrypt a message, you must first select or compose a magic square of suitable size, then draw an empty table of the same size, and enter the letters of the text one by one into the table in accordance with the numbers in the magic square. Then we simply write down the letters from the table line by line into one long string. The order of the square must be equal to the rounded big side root of the length of the encrypted string so that the string fits completely into the square. If the line is shorter, then the remainder can be filled with arbitrary letters or numbers.

At first glance, it seems as if there are very few magic squares. However, their number increases very quickly as the size of the square increases. Thus, there is only one magic square of size 3x3, if you do not take into account its rotations and reflections. The number of magic squares of the 4th order is already counting in hundreds, of the 5th - in hundreds of thousands. Therefore, magic squares large sizes could have been a good basis for a reliable encryption system of that time, since manual enumeration of all key options for this cipher was unthinkable.

There is a very simple method for composing odd magic squares, i.e. sizes 3x3, 5x5, 7x7, etc. This is the “terrace” or “pyramid” method.

A square is drawn the right size and stepped “terraces” are added to it (indicated by a dotted line). Next, along the diagonals from top to bottom to the right, the square is filled with successive numbers. After this, the “terraces” are transferred inside the square: the right ones - to the left, the left ones - to the right, the upper ones - down, and the lower ones - up. It turns out to be a magic square!

Based on this method, you can create different puzzles. If you use the method directly, you will get a puzzle like this:

To solve this puzzle, you need to move the letters from the “terraces” into a square, then the square will read full message. The phrase “There is an ambush behind the bridge, you can’t get through, cross the river into a ford” is encrypted here.

And if you use the method the other way around, you will end up with a puzzle like this.

To solve it, you need to pull out the corresponding letters from the square into the “terraces”.

For squares 4x4, 6x6, etc. such simple ways there is no compilation of them, so it’s easier to use ready-made ones. For example, the Durer square.