Encryption by the permutation method. Types and methods of ciphers

Table of contents:

Encryption by the permutation method. Types and methods of ciphers
Encryption by the permutation method. Types and methods of ciphers
Anonim

Aatbash, Scytal cipher, Cardano lattice - well-known ways to 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 plain text change positions according to a certain rule. In other words, the key to the cipher is the reordering of the characters in the open message. However, the dependence of the key on the length of the encrypted text gave rise to many inconveniences for using this type of cipher. But smart heads have found interesting tricky solutions, which are described in the article.

Reversed groups

To get acquainted with encryption by the permutation method, let's mention one of the simplest examples. Its algorithm consists in dividing the message into n blocks, which are then flipped back to front and swapped. Consider an example.

"The day was gone and the sky is dark air"

Let's divide this message into groups. In this case, n=6.

"Denuh odily nebav cool cool"

Now expand the groups, writing each from the end.

"hunned waben dzo methu yin"

Let's swap places in a certain way.

"ilido methu yin hunned waben dzo"

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

Middle insert

The algorithm of this encryption is slightly more complicated than the encryption method of permutation:

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

Let's look at an example.

  1. "He took the creatures to sleep".
  2. "Earth yetv ariu drive lkosnu".
  3. "Zeamn yabtv arayu voabdi lkoasnu".

In this case, alternating letters "a" and "ab" were inserted in the middle of the groups. Inserts can be different, in different numbers and not repeated. In addition, you can expand each group, shuffle them, etc.

Ciphergram "Sandwich"

Another interesting and simple example of permutation encryption. To use it, you need to divide the plain text into 2 halves and enter one of them character by character between the letters of the other. Let's use an example.

Encryption "sandwich"
Encryption "sandwich"

"From themworks; I'm the only one, homeless"

Divided into halves with an equal number of letters.

From their labors, only I am homeless

Now write the first half of the message with more letter spacing.

"O T and X T R U D DOL and Sh"

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

"Oyatoidhitnrbuedzodvolminshiy"

Finally group the letters into sort of words (optional operation).

"Oyatoi dhi tnrbue dzodvol minshhy"

It is very easy to encrypt text with this method. The uninitiated will have to figure out the resulting string-rubbish for some time.

Permutations along the "route"

This is the name given to ciphers widely used in antiquity. The route in their construction was any geometric figure. The plaintext was written into such a figure according to a certain scheme, and extracted according to its reverse. For example, one of the options may be to write to the plaintext table according to the scheme: the snake crawls in the cells clockwise, and the encrypted message is composed by writing off the columns in one line, from the first to the last. This is also a permutation encryption.

Simple permutation ciphers
Simple permutation ciphers

Let's show by example how to encrypt text. Try to determine the recording route and the ciphergram compilation route yourself.

"Prepare to endure the war".

We will write the message into a table of 3x9 cells. Table dimensioncan be determined based on the length of the message, or some fixed table can be used multiple times.

p r and r o t o to l
r e d s to me c l me
f a t b to o th n y

We will compose the cipher starting from the upper right corner of the table.

"Launlvosoyatovvygidtaerprj"

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

Vertical permutations

This type of cipher is also a variant of route permutation. It is interesting in the first place by the presence of a key. This method was widely used in the past and also used tables for encryption. The message is recorded in the table in the usual way - from top to bottom, and the ciphergram is written out vertically, while respecting the order indicated by the key or password. Let's look at a sample of such encryption.

"Both with a painful path and with compassion"

Use a table of 4x8 cells and write our message in it in the usual way. And for encryptionuse key 85241673.

and c t me r o c t
n s m p y t e m
and c c o c t r a
d a n b e m

The key is shown below.

8 5 2 4 1 6 7 3

Now, using the key as an indication of the order, write the columns into a row.

"Gusetmsntmayposysaottmserinid"

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 ciphertext. 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 divisors of the message length.

Vertical permutation reversed

Vertical permutation is of interest because the decryption of a message is not a simple reversal of the algorithm. Whoever knows the key knows how many columns the table has. To decrypt a message, you need to determine the number of long and short lines in the table. This will determine the beginning, from where to start writing the ciphertext to the table in order to read the plaintext. To do this, we divide the lengthmessages by the length of the key and we get 30/8=3 and 6 in the remainder.

Permutation ciphers
Permutation ciphers

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

Cardano grille

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

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

Using a simple Cardano lattice as an example (shown below).

Grille Cardano
Grille Cardano

Using this stencil, encrypt the phrase "O Muses, I will appeal to you."

- O - M - -
U
З S
K
B A
M

Fill the stencil cells with letters according to the rule: first from right to left, and then from top to bottom. When the cells run out, rotate the stencil 90 ° clockwise. In this way we get the following table.

I - - - - -
O B R
A Sch
y
С b

And rotate it 90° again.

- - - - - С
B O
З
B A
N
b E

And the last turn.

- - M - - -

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

I O M M G С
B O U B O R
G З A З Sch S
B G K G A U
G B G N G A
M С b b E G

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

YAVGVGM OOZGVS MUAKGY MBZGN GOSCHAGE SRYUAG

In order to decrypt this message, the recipient must have an exact copy of the stencil that was used to encrypt it. This cipher has long been considered fairly stable. It also has many variations. For example, the use of 4 Cardano gratings at once, each of which rotatesin my own way.

Gimbal grille encryption
Gimbal grille encryption

Analysis of permutation ciphers

Cryptanalysis of ciphers
Cryptanalysis of ciphers

All permutation ciphers are vulnerable to frequency analysis. Especially in cases where the length of the message is comparable to the length of the key. And this fact cannot be changed by repeatedly applying 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.

Recommended: