What types of permutation cipher are there? Route rearrangement

(see also )

Big influence The development of cryptography was influenced by the works of the American mathematician Claude Shannon that appeared in the mid-20th century. These works laid the foundations of information theory, and also developed a mathematical apparatus for research in many areas of science related to information. Moreover, it is generally accepted that information theory as a science was born in 1948 after the publication of K. Shannon’s work “Mathematical Theory of Communication”.

In his work “The Theory of Communication in Secret Systems,” Claude Shannon summarized the experience accumulated before him in the development of ciphers. It turned out that even in very complex ciphers the following can be identified as typical components: simple ciphers How substitution ciphers, permutation ciphers or combinations thereof.

The primary characteristic by which ciphers are classified is the type of transformation performed on the plaintext during encryption. If fragments of plaintext (individual letters or groups of letters) are replaced by some of their equivalents in the ciphertext, then the corresponding cipher belongs to the class replacement ciphers. If the letters of the plaintext during encryption only change places with each other, then we are dealing with permutation cipher. In order to increase the reliability of encryption, the ciphertext obtained using a certain cipher can be encrypted again using a different cipher.


Rice. 6.1.

All possible such compositions of various ciphers lead to the third class of ciphers, which are usually called composition ciphers. Note that a composition cipher may not be included in either the class of substitution ciphers or the class of permutation ciphers (Fig. 6.1).

6.3 Permutation ciphers

A permutation cipher, as its name suggests, transforms the permutation of letters in plaintext. A typical example The permutation cipher is the "Scital" cipher. Usually plaintext breaks into segments equal length and each segment is encrypted independently. Let, for example, the length of the segments be equal to and be a one-to-one mapping of the set into itself. Then the permutation cipher works like this: a piece of plaintext is converted into a piece of ciphertext.

A classic example of such a cipher is a system using a card with holes - grille, which, when applied to a sheet of paper, leaves only some parts of it exposed. When encrypted, the letters of the message fit into these holes. When decrypted, the message fits into the diagram required sizes, then a hash mark is applied, after which only the letters of the plaintext are visible.

Other permutation cipher options are also possible, such as columnar and double permutation ciphers.

6.3.1 Column permutation cipher

During decryption, the letters of the ciphertext are written in columns according to the sequence of key numbers, after which the original text is read in rows. To make it easier to remember the key, rearrange the table columns according to keyword or a phrase, all characters of which are assigned numbers determined by the order of the corresponding letters in the alphabet.

When solving tasks for cryptanalysis of permutation ciphers, it is necessary to restore the initial order of the letters of the text. To do this, character compatibility analysis is used, which a compatibility table can help with (see).

Table 6.1. Combination of Russian letters
G WITH Left On right G WITH
3 97 l, d, k, t, v, r, n A l, n, s, t, r, v, k, m 12 88
80 20 i, e, y, i, a, o B o, s, e, a, r, y 81 19
68 32 i, t, a, e, i, o IN o, a, i, s, s, n, l, r 60 40
78 22 r, y, a, i, e, o G o, a, p, l, i, v 69 31
72 28 r, i, y, a, i, e, o D e, a, i, o, n, y, p, v 68 32
19 81 m, i, l, d, t, r, n E n, t, r, s, l, v, m, i 12 88
83 17 r, e, i, a, y, o AND e, i, d, a, n 71 29
89 11 o, e, a, and 3 a, n, c, o, m, d 51 49
27 73 r, t, m, i, o, l, n AND s, n, c, i, e, m, k, h 25 75
55 45 b, v, e, o, a, i, s TO o, a, i, p, y, t, l, e 73 27
77 23 g, v, s, i, e, o, a L i, e, o, a, b, i, yu, y 75 25
80 20 i, s, a, i, e, o M i, e, o, y, a, n, p, s 73 27
55 45 d, b, n, o, a, i, e N o, a, i, e, s, n, y 80 20
11 89 r, p, k, v, t, n ABOUT c, s, t, r, i, d, n, m 15 85
65 35 in, with, y, a, i, e, o P o, p, e, a, y, i, l 68 32
55 45 i, k, t, a, p, o, e R a, e, o, i, u, i, s, n 80 20
69 31 s, t, v, a, e, i, o WITH t, k, o, i, e, b, s, n 32 68
57 43 h, y, i, a, e, o, s T o, a, e, i, b, v, r, s 63 37
15 85 p, t, k, d, n, m, r U t, p, s, d, n, y, w 16 84
70 30 n, a, e, o, and F and, e, o, a, e, o, a 81 19
90 10 y, e, o, a, s, and X o, i, s, n, v, p, r 43 57
69 31 e, yu, n, a, and C i, e, a, s 93 7
82 18 e, a, y, i, o H e, i, t, n 66 34
67 33 b, y, s, e, o, a, i, v Sh e, i, n, a, o, l 68 32
84 16 e, b, a, i, y SCH e, i, a 97 3
0 100 m, r, t, s, b, c, n Y L, x, e, m, i, v, s, n 56 44
0 100 n, s, t, l b n, k, v, p, s, e, o, and 24 76
14 86 s, s, m, l, d, t, r, n E n, t, r, s, k 0 100
58 42 b, o, a, i, l, y YU d, t, sch, c, n, p 11 89
43 57 o, n, r, l, a, i, s I c, s, t, p, d, k, m, l 16 84

When analyzing the compatibility of letters with each other, one should keep in mind the dependence of the appearance of letters in plain text on a significant number of preceding letters. To analyze these patterns, the concept of conditional probability is used.

The question of the dependence of the letters of the alphabet in plaintext on previous letters was systematically studied by the famous Russian mathematician A.A. Markov (1856-1922). He proved that the occurrences of letters in plaintext cannot be considered independent of each other. In this regard, A.A. Markov noted another stable pattern of open texts associated with the alternation of vowels and consonants. He calculated the frequency of occurrence of vowel-vowel bigrams ( g, g), vowel-consonant ( g, s), consonant-vowel ( s, g), consonant-consonant ( s, s) in Russian text with a length of characters. The calculation results are shown in the following table:

Table 6.2. Alternation of vowels and consonants
G WITH Total
G 6588 38310 44898
WITH 38296 16806 55102

Example 6.2 The plaintext, keeping spaces between words, was recorded in a table. The beginning was in the first line, the text was written from left to right, moving from line to the next, encryption consisted of rearranging the columns. Find the plaintext.

Cipher text:

D IN Y T
G ABOUT E R ABOUT
U b D U B
M M I Y R P

Solution. Let's assign numbers to the columns in the order they appear. Our task is to find an order of columns in which the text will make sense.

Let's make a table:

1 2 3 4 5 6
1 X
2 X
3 X
4 X
5 X
6 X

A cell (, ) in this table means that the column number follows the column number . We mark impossible cases with an "X".

Combinations of columns 1, 2 and 5, 2 are not possible, since a vowel cannot appear before a soft sign. The sequences of columns 2, 1 and 2, 5 are also impossible. Now from the third line it follows that 1, 5 and 5, 1 are impossible, since УУ is a bigram uncharacteristic for the Russian language. Next, two spaces in a row cannot be in the text, which means we put “X” in cells 3, 4 and 4, 3. Let’s turn to the third line again. If column 2 followed column 4, the word would begin with a soft sign. We put “X” in cell 4, 2. From the first line: the combination 4, 5 is impossible, and 3, 5 is also impossible. The result of our reasoning is presented in the table:

1 2 3 4 5 6
1 X X X
2 X X X
3 X X X
4 X X X X
5 X X X
6 X

So, after column 6, column 5 must necessarily follow. But then we put an “X” in cell 6, 2 and we get: column 2 follows column 3. Next, we crossed out 5, 1 and 2, 1, therefore, we need to check the options: . ..6532... and...65432... . But (4, 3) was crossed out earlier. So, the remaining options for the arrangement of columns are:

  • 1, 6, 5, 3, 2, 4
  • 6, 5, 3, 2, 4, 1
  • 4, 1, 6, 5, 3, 2
  • 1, 4, 6, 5, 3, 2

Let's write 6, 5, 3, 2 columns in a row:

6 5 3 2
T s - V
O R O G
b at d b
P R I m

Trying to put column 1 before column 6 will result in the bigram MP in the last row and the combination DTY in the first. The remaining options are: 653241, 146532.

Answer: 653241 - key, plain text: you\_on\_the road\_be\_stubborn (line from a song popular in the 1970s).

Let's give another example of cryptanalysis of a column permutation cipher.

Example 6.3 Decipher: SVPOOSLUYYST\_EDPSOKOKAIZO

Solution. The text contains 25 characters, which allows you to write it in square matrix 5x5. It is known that encryption was carried out column by column, therefore, decryption should be carried out by changing the order of the columns.

In permutation encryption, the characters of the encrypted text are rearranged according to certain rules within the encrypted block of this text.

Simple rearrangement

An encryption block size of n columns and m rows and a key sequence are selected, which is formed from a natural series of numbers 1,2,...,n by random permutation.

Encryption is carried out in the following order:

    The encrypted text is written in successive lines under the key sequence numbers, forming an encryption block of size n*m.

    The ciphertext is written out in columns in ascending order of column numbers specified by the key sequence.

    Filled out new block etc.

For example, let's encrypt the text

LOAD_ORANGES_IN BARRELS

block size 8*3 and key 5-8-1-3-7-4-6-2.

A simple permutation table will look like:

G R U Z I T E _

ORANGE

Y _ B O C H K A H

Encrypted message:

WEB_NHZLOESLGAYEIAICHRP_

Decryption is performed in the following order:

    A block of characters of size n*m ​​is extracted from the ciphertext.

    This block is divided into n groups of m characters.

    Symbols are written to those columns of the permutation table whose numbers coincide with the group numbers in the block. The decrypted text is read according to the rows of the permutation table.

    A new block of characters is allocated, etc.

Permutation complicated according to the table

When permutation across tables becomes more complex, unused cells of the table are introduced into the permutation table to increase the strength of the cipher. The number and location of unused elements is an additional encryption key.

When encrypting text, text characters are not written into unused elements, and no characters from them are written into the ciphertext - they are simply skipped. When decrypting, ciphertext characters are also not included in unused elements.

To further increase the cryptographic strength of the cipher, during the encryption process you can change the keys, the size of the permutation table, the number and location of unused elements according to some algorithm, and this algorithm becomes an additional cipher key.

Permutation complicated by routes

High encryption strength can be ensured by complicating permutations along Hamiltonian-type routes. 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 of a three-dimensional hypercube is shown in Figure 6.

Figure 6. Three-dimensional hypercube

The numbers of the cube's vertices determine the sequence in which it is filled with ciphertext symbols when forming a block. In general, an n-dimensional hypercube has n 2 vertices.

Figure 7. Hamilton routes

The sequence of symbol permutations in the encrypted block for the first scheme is 5-6-2-1-3-4-8-7, and for the second it is 5-1-3-4-2-6-8-7. Similarly, you can obtain a sequence of permutations for other routes: 5-7-3-1-2-6-8-4, 5-6-8-7-3-1-2-4, 5-1-2-4-3 -7-8-6, etc.

The dimension of the hypercube and the number of types of selected Hamilton routes constitute the secret key of the method.

The stability of a simple permutation is uniquely determined by the size of the permutation matrix used. For example, when using a 16*16 matrix, the number of possible permutations reaches 1.4E26. It is impossible to sort through such a number of options even using a computer. The stability of complicated permutations is even higher. However, it should be borne in mind that when encrypting by permutation, the probabilistic characteristics are completely preserved source text, which makes cryptanalysis easier.

Encryption using the magic square method.

Magic squares are square tables with consecutive natural numbers inscribed in their cells, starting from 1, which add up to the same number for each column, row and diagonal.

When encrypting, the letters of the plaintext must be entered into the magic square in accordance with the numbering of its cells. To obtain the ciphertext, read the contents of the completed table row by row.

Let's encrypt the phrase “MAGIC POWER” using a 4x4 magic square. To do this, we will choose one of 880 options for magic squares of a given size (Figure 8a). Then we enter each letter of the message in a separate cell of the table with a number corresponding to the serial number of the letter in the original phrase (Figure 8b). When reading the filled table row by row, we get the ciphertext: “_GAIAESSCHYA_KIALM”.

Figure 8. Example of encryption using magic squares

along different paths of a geometric figure.

The simplest example of a permutation is permutation with fixed period d. In this method, the message is divided into blocks according to d characters and the same permutation is performed in each block. The rule by which the permutation is performed is a key and can be specified by some permutation of the first d natural numbers. As a result, the letters of the message themselves do not change, but are transmitted in a different order.

For example, for d=6, you can take 436215 as the permutation key. This means that in each block of 6 characters, the fourth character goes to first place, the third to second, the sixth to third, etc. Suppose you need to encrypt the following text:

The number of characters in the original message is 24, therefore, the message must be divided into 4 blocks. The result of encryption using the permutation 436215 will be the message

OETET_TLSKDISHR_YAFNAVOI

Theoretically, if a block consists of d characters, then the number of possible permutations d!=1*2*...*(d-1)*d . In the last example d=6, therefore, the number of permutations is 6!=1*2*3*4*5*6=720. Thus, if an adversary intercepted the encrypted message in the example above, it would take him no more than 720 attempts to resolve the original message (assuming the block size is known to the adversary).

To increase cryptographic strength, two or more permutations with different periods can be sequentially applied to the encrypted message.

Another example of permutation methods is table rearrangement. In this method, the source text is written along the rows of a table and reads it along the columns of the same table. The sequence of filling rows and reading columns can be any and is specified by a key.

Let's look at an example. Let the encoding table have 4 columns and 3 rows (block size is 3*4=12 characters). Let's encrypt the following text:

The number of characters in the original message is 24, therefore, the message must be divided into 2 blocks. Let's write each block in its own table line by line (Table 2.9).

Table 2.9. Encryption using table permutation method
1 block
E T ABOUT
T E TO WITH
T D L
2 block
I Sh AND
F R ABOUT IN
A N AND I

Then we will read each block from the table sequentially column by column:

ETTTE OKD SLYAFA RNSHOIVYA

You can read the columns not sequentially, but, for example, like this: third, second, first, fourth:

OKDTE ETT SLSHOI RNYAFAIVA

In this case, the order in which the columns are read will be the key.

If message size is not a multiple of the block size, you can supplement the message with any symbols that do not affect the meaning, for example, spaces. However, this is not recommended, since it gives the enemy, in case of interception of the cryptogram, information about the size of the permutation table used (block length). After determining the block length, the adversary can find the key length (number of table columns) among the block length divisors.

Let's see how to encrypt and decrypt a message that is not a multiple of the size of the permutation table. Let's encrypt the word

CHANGE

The number of characters in the original message is 9. Let's write the message into the table line by line (Table 2.10), and leave the last three cells empty.

Then we will read from the table sequentially by columns:

PMAEERNEC

To decrypt, first determine the number of complete columns, that is, the number of characters in the last line. For this they divide message size(in our example – 9) by the number of columns or key size (in the example – 4). The remainder of the division will be the number of complete columns: 9 mod 4 = 1. Therefore, in our example there was 1 full column and three short ones. Now you can put the letters of the message in their places and decipher the message. Since the encryption key was the number 1234 (the columns were read sequentially), then when decrypting, the first three characters (PMA) are written in the first column of the permutation table, the next two (EE) - in the second column, the next two (RN) - in the third, and the last two (EK) - in the fourth. After filling the table, we read the rows and get Original message CHANGE.

There are other permutation methods that can be implemented in software and hardware. For example, when transmitting data written in binary form, it is convenient to use a hardware unit that shuffles in a certain way by appropriate wiring, bits of the original n-bit message. So, if we take the block size to be eight bits, we can, for example, use a permutation block such as

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.

Route permutation ciphers

The so-called route permutations using some geometric figure (flat or three-dimensional) have become widespread. 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 widely used are permutation route ciphers 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.

Vertical permutation cipher

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).

Aatbash, Scital cipher, Cardano lattice - known methods hide information from prying eyes. In the classical sense, a permutation cipher is an anagram. Its essence lies in the fact that the letters of the plaintext change positions according to a certain rule. In other words, the cipher key is to change the order of characters in open message. However, the dependence of the key on the length of the encrypted text has created many inconveniences for using this type of cipher. But smart heads have found interesting, cunning solutions that are described in the article.

Inverted groups

To get acquainted with encryption using the permutation method, we will mention one of the simplest examples. Its algorithm consists of dividing a message into n blocks, which are then turned backwards and swapped. Let's look at an example.

  • "The day was passing, and the air was dark in the sky."

Let's divide this message into groups. IN in this case n = 6.

  • "Denukh odili nebav ozd uhtemny."

Now let's expand the groups, writing each one from the end.

  • "hunned vaben dzo methu yyn."

Let's rearrange them in a certain way.

  • "ilido methu yyn huned vaben dzo."

To an ignorant person, in this form the message is nothing more than rubbish. But, of course, the one to whom the message is addressed is in charge of the decryption algorithm.

Middle insert

Algorithm given encryption a little more complicated permutation:

  1. Divide the message into groups with an even number of characters.
  2. Insert additional letters in the middle of each group.

Let's look at an example.

    "He led the creatures of the earth to sleep."

    "Zemn yetv ariu vodi lkosnu."

    "Zeamn yeabtv araiu voabdi lkoasnu."

In this case, alternating letters “a” and “ab” were inserted into the middle of the groups. Inserts can be different, depending on different quantities and don't repeat yourself. In addition, you can expand each group, shuffle them, etc.

Cipher code "Sandwich"

Another fun and simple example of permutation encryption. To use it, you need to divide the plaintext into 2 halves and write one of them character by character between the letters of the other. Let's show it with an example.

  • "From their labors; only I am alone, homeless."

Divide into halves with an equal number of letters.

  • "I'm the only homeless person out of their labor."

Now let's write the first half of the message with a large space between letters.

  • "About t i h t u d o v l i s h ."

And in these spaces we will place the letters of the second half.

  • "Oyatoidhitnrbuedzodvolminshy."

Finally, let's group the letters into a kind of words (optional operation).

  • "Oyatoi dhi tnrbue dzodvol minshyy."

It is very easy to encrypt text using this method. The resulting line of nonsense will have to take some time for the uninitiated to unravel.

Rearrangements along the "route"

This name was given to ciphers that were widely used in ancient times. The route in their construction was any geometric figure. The plaintext was written into such a figure according to a certain pattern, and retrieved according to its inverse. For example, one option might be to write plaintext into a table using the scheme: a snake crawls clockwise through the cells, and an encrypted message is composed by writing the columns into one row, from the first to the last. This is also permutation encryption.

Let's show with an example how to encrypt text. Try to determine the recording route and the encryption route yourself.

    "I was preparing to endure the war."

We will write the message in a table with dimensions of 3x9 cells. The table size can be determined based on the message length, or some fixed table can be used several times.

We will compose the cipher starting from the right top corner tables.

  • "Launlvosoyatovvygidtaerprzh."

Reversing the steps described is not difficult. It's enough to just do the opposite. This method is extremely convenient because it makes it easy to remember the encryption and decryption procedure. It is also interesting because any shape can be used for a cipher. For example, a spiral.

Vertical permutations

This type of cipher is also a variant of route permutation. It is interesting primarily because of the presence of a key. This method was widespread in the past and also used tables for encryption. The message is written into the table in the usual way - from top to bottom, and the ciphergram is written vertically, while maintaining the order specified by the key or password. Let's look at an example of such encryption.

    "Both with a painful path and with compassion"

We use a table with dimensions of 4x8 cells and write our message in it in the usual way. And for encryption we use the key 85241673.

Now, using the key as an indication of the order, let's write the columns into a line.

  • "Gusetmsntmayapoysaotmserinid."

It is important to note that with this encryption method, empty cells in the table should not be filled with random letters or symbols, hoping that this will complicate the ciphergram. In fact, on the contrary, such an action will give the enemies a hint. Because the key length will be equal to one of the message length divisors.

Reverse decoding of vertical permutation

Vertical permutation is interesting because decrypting a message is not simply following an algorithm in reverse. Anyone who knows the key knows how many columns there are in the table. To decrypt a message, you need to determine the number of long and short lines in the table. This will allow you to determine the beginning from where to start writing the ciphergram into the table in order to read the plaintext. To do this, divide the message length by the key length and get 30/8=3 and 6 as a remainder.

Thus, we learned that the table has 6 long columns and 2 short ones, not completely filled with letters. Looking at the key, we see that the encryption started at the 5th column and it should be long. So we find that the first 4 letters of the ciphergram correspond to the fifth column of the table. Now you can write down all the letters in their places and read the secret message.

This type belongs to the so-called stencil ciphers, but at its core is encryption by the method of symbol permutation. The key is a stencil in the shape of a table with holes cut in it. In fact, the stencil can be any shape, but most often a square or table is used.

The Cardano stencil is made using to the following principle: cut cells should not overlap each other when rotated 90°. That is, after 4 rotations of the stencil around its axis, the slots in it should not coincide even once.

Let's use a simple Cardano lattice as an example (in the figure below).

Using this stencil, we will encrypt the phrase “O Muses, I will address you with an appeal.”

- ABOUT - M - -
U
Z Y
TO
IN A
M

We fill the cells of the stencil with letters according to the rule: first from right to left, and then from top to bottom. When the cells run out, turn the stencil 90° clockwise. In this way we obtain the following table.

And the last turn.

- - M - - -

After combining 4 tables into one, we get the final encrypted message.

I ABOUT M M G WITH
IN ABOUT U B ABOUT R
G Z A Z SCH Y
IN G TO G A U
G IN G N G A
M WITH b b E G

Although the message may remain the same, it will be more convenient to receive a familiar-looking ciphergram for transmission. To do this, you can fill empty cells with random letters and write the columns in one line:

  • "YAVGVGM OOZGVS MUAKG MBZGN GOSCHAGE SRYUAG"

In order to decipher this message, the recipient must have an exact copy stencil that was used for encryption. This cipher for a long time was considered quite stable. It also has many variations. For example, using 4 Cardano grids at once, each of which rotates in its own way.

Analysis of permutation ciphers

All permutation ciphers vulnerable against frequency analysis. Especially in cases where the message length is comparable to the key length. And this fact cannot be changed by repeated use of permutations, no matter how complex they may be. Therefore, in cryptography, only those ciphers that use several mechanisms at once, in addition to permutation, can be stable.