How to come up with your own code. How to create a secret code or cipher

Please complain to pay anai iptography land sai ikihauwai! Whether you're writing notes to your friends in class or trying to figure out cryptography (the science of codes and ciphers) for fun, this article can help you learn some basic principles and create your own way to encode private messages. Read step 1 below to get an idea of ​​where to start!


Some people use the words "code" and "cipher" to refer to the same concepts, but those who seriously study this issue know that these are two completely different concepts. A secret code is a system in which each word or phrase in your message is replaced by another word, phrase, or series of characters. A cipher is a system in which each letter of your message is replaced by another letter or symbol.

Steps

Codes

Standard codes

    Create your message. Using a code book, write the message carefully and carefully. Note that pairing your code with a cipher will make your message even more secure!

    Translate your message. When your friends receive the message, they will need to use their copy of the code book to translate the message. Make sure they know that you are using a double protection method.

    Book of code

    police coding

    Ciphers

    Date based encryption

    1. Choose a date. For example, it would be Steven Spielberg's birthday on December 16, 1946. Write this date using numbers and slashes (12/18/46), then remove the dashes to get the six-digit number 121846, which you can use to send an encrypted message.

      Assign a number to each letter. Imagine the message "I like Steven Spielberg's movies". Under the message, you write your six-digit number over and over until the very end of the sentence: 121 84612184 612184 6121846 121846121.

      Encrypt your message. Write the letters from left to right. Move each plain text letter by the number of units listed below it. The letter "M" is shifted by one unit and becomes "H", the letter "H" is shifted by two units and becomes "P". Please note that the letter "I" is shifted by 2 units, for this you need to jump to the beginning of the alphabet, and it becomes "B". Your final message will be “Npyo hfögbuschg ynyfya chukgmse tsyuekseb”.

      Translate your message. When someone wants to read your message, all they need to know is what date you used to encode. To recode, use the reverse process: write the numeric code, then return the letters in the opposite order.

      • Encoding with a date has the additional advantage that the date can be absolutely anything. You can also change the date at any time. This makes updating the cipher system much easier than with other methods. However, it is better to avoid such famous dates as May 9, 1945.

    Encryption with a number

    1. Choose a secret number with your friend. For example, the number 5.

      Write your message (no spaces) with this number of letters on each line (don't worry if the last line is shorter). For example, the message "My cover is blown" would look like this:

      • Moepr
      • caviar
      • ieras
      • covered
    2. To create a cipher, take the letters from top to bottom and write them down. The message will be "Myikokererrypyatrtao".

      To decipher your message, your friend must count the total number of letters, divide it by 5, and determine if there are incomplete lines. After that, he/she writes these letters in columns so that there are 5 letters in each row and one incomplete line (if any), and reads the message.

    Graphic cipher

    Rearrangement of Caesar

    Secret languages

    confused language

    Sound code

    gibberish

    • Hide your code in a place that only the sender and recipient know about. For example, unscrew any pen and put your code inside it, assemble the pen back, find a place (like a pencil holder) and tell the recipient the place and type of the pen.
    • Encrypt spaces as well to confuse the code even more. For example, you can use letters (E, T, A, O, and H work best) instead of spaces. They are called blanks. The s, b, b, and z will look too obvious for experienced codebreakers, so don't use them or other characters that stand out.
    • You can create your own code by rearranging the letters in the words randomly. "Dij yaemn in the park" - "Wait for me in the park."
    • Always send codes to agents on your side.
    • When using Turkish Irish, you don't need to specifically use "eb" before a consonant. You can use "ie", "br", "of" or any other inconspicuous combination of letters.
    • When using positional encoding, feel free to add, remove, and even rearrange letters from one place to another to make deciphering even more difficult. Make sure your partner understands what you are doing or it will all be meaningless to her/him. You can split the text into parts so that there are three, four or five letters in each, and then swap them.
    • For rearranging Caesar, you can rearrange the letters as many places as you want, forward or backward. Just make sure the permutation rules are the same for each letter.
    • Always destroy decrypted messages.
    • If you're using your own code, don't make it too complicated for others to figure it out. It may be too difficult to decipher even for you!
    • Use Morse code. This is one of the most famous codes, so your interlocutor will quickly understand what it is.

    Warnings

    • If you write the code inaccurately, this will make the decoding process more difficult for your partner, provided that you do not use variations of codes or ciphers designed specifically to confuse the decryptor (except your partner, of course).
    • Confused language is best used for short words. It's not as effective with long words because the extra letters are much more visible. The same is true when using it in speech.

Methods: explanatory and illustrative, partially exploratory.

  • Create conditions for increasing cognitive interest in the subject.
  • Contribute to the development of analytical-synthesizing thinking.
  • Contribute to the formation of skills and abilities that are of a general scientific and general intellectual nature.

Tasks:

educational:

  • generalize and systematize knowledge of the basic concepts: code, coding, cryptography;
  • get acquainted with the simplest encryption methods and their creators;
  • develop the ability to read encryption and encrypt information;

developing:

  • develop cognitive activity and creative abilities of students;
  • form logical and abstract thinking;
  • develop the ability to apply the acquired knowledge in non-standard situations;
  • develop imagination and mindfulness;

educational:

  • foster a communicative culture;
  • develop curiosity.

The proposed development can be used for students in grades 7-9. The presentation helps to make the material visual and accessible.

The society in which a person lives deals with information throughout its development. It is accumulated, processed, stored, transmitted. (Slide 2. Presentation)

And does everyone always have to know everything?

Of course not.

People have always sought to hide their secrets. Today you will get acquainted with the history of the development of cryptography, learn the simplest methods of encryption. You will be able to decipher the messages.

Simple encryption techniques were used and gained some distribution already in the era of the ancient kingdoms and in antiquity.

Cryptography - cryptography - is the same age as writing. The history of cryptography has more than one millennium. The idea of ​​creating texts with hidden meanings and encrypted messages is almost as old as the art of writing itself. There is a lot of evidence for this. Clay tablet from Ugarit (Syria) - exercises teaching the art of deciphering (1200 BC). The “Babylonian Theodicy” from Iraq is an example of an acrostic (mid-2nd millennium BC).

One of the first systematic ciphers was developed by the ancient Jews; this method is called temura - “exchange”.

The simplest of them is “Atbash”, the alphabet was divided in the middle so that the first two letters, A and B, coincided with the last two, T and Sh. The use of the Temur cipher can be found in the Bible. This prophecy of Jeremiah, made at the beginning of the 6th century BC, contains a curse to all the rulers of the world, ending with the “king of Sesach” who, when deciphered from the “Atbash” cipher, turns out to be the king of Babylon.

(Slide 3) A more ingenious encryption method was invented in ancient Sparta during the time of Lycurgus (V century BC). To encrypt the text, Scitalla was used - a cylindrical rod, on which a tape of parchment was wound. The text was written line by line along the axis of the cylinder, the tape was unwound from the wand and passed to the addressee, who had a Scytall of the same diameter. This method permuted the letters of the message. The cipher key was the diameter of Scitalla. ARISTOTLE came up with a method for breaking such a cipher. He invented the Antiscital decryption device.

(Slide 4) Task "Check yourself"

(Slide 5) The Greek writer POLYBIUS used a signaling system that was used as a method of encryption. With its help it was possible to transfer absolutely any information. He wrote down the letters of the alphabet in a square table and replaced them with coordinates. The stability of this cipher was great. The main reason for this was the ability to constantly change the sequence of letters in the square.

(Slide 6) Task "Check yourself"

(Slide 7) A special role in preserving the secret was played by the encryption method proposed by JULIUS CAESAR and described by him in “Notes on the Gallic War.

(Slide 8) Task "Check yourself"

(Slide 9) There are several modifications of the Caesar cipher. One of them is the Gronsfeld cipher algorithm (created in 1734 by the Belgian José de Bronkhor, Comte de Gronsfeld, a military man and diplomat). Encryption lies in the fact that the shift value is not constant, but is set by a key (gamma).

(Slide 10) For the one who transmits the encryption, its resistance to decryption is important. This characteristic of a cipher is called cryptographic strength. To increase cryptographic strength allow ciphers with many alphabetic or multi-valued substitutions. In such ciphers, each character of the open alphabet is assigned not one, but several cipher characters.

(Slide 11) Scientific methods in cryptography first appeared in the Arab countries. Arabic origin and the word cipher itself (from the Arabic "number"). The Arabs were the first to replace letters with numbers in order to protect the original text. The secret writing and its meaning are even mentioned in the fairy tales of the Thousand and One Nights. The first book, specifically dedicated to the description of some ciphers, appeared in 855, it was called “The Book of the Great Aspiration of Man to Unravel the Mysteries of Ancient Writing”.

(Slide 12) The Italian mathematician and philosopher GEROLAMO CARDANO wrote the book "On the Subtleties", which has a part on cryptography.

His contribution to the science of cryptography contains two sentences:

The first is to use the plaintext as the key.

Secondly, he proposed a cipher, now called the Cardano Grid.

In addition to these proposals, Cardano gives a "proof" of the strength of ciphers based on counting the number of keys.

The Cardano grille is a sheet of hard material in which, at regular intervals, rectangular cuts are made, one stitch high and of various lengths. By superimposing this lattice on a sheet of writing paper, it was possible to write a secret message into the cutouts. The remaining spaces were filled with arbitrary text masking the secret message. This method of disguise was used by many famous historical figures, Cardinal Richelieu in France and the Russian diplomat A. Griboyedov. On the basis of such a lattice, Cardano constructed a permutation cipher.

(Slide 13) Task "Check yourself"

(Slide 14) They were also fond of cryptography in Russia. The ciphers used are the same as in Western countries - icon, substitutions, permutations.

The date of the emergence of the cryptographic service in Russia should be considered 1549 (the reign of Ivan IV), from the moment the "ambassadorial order" was formed, in which there was a "digital department".

Peter I completely reorganized the cryptographic service, creating the "Ambassador's Office". At this time, codes are used for encryption, as applications to "digital alphabets". In the famous "case of Tsarevich Alexei" "digital alphabets" also appeared in the accusatory materials.

(Slide 15) Task "Check yourself"

(Slide 16) The 19th century brought many new ideas in cryptography. THOMAS JEFFERSON created an encryption system that occupies a special place in the history of cryptography - the "disk cipher". This cipher was implemented using a special device, which was later called the Jefferson cipher.

In 1817, DESIUS WADSWORTH designed an encryption device that introduced a new principle into cryptography. The innovation was that he made plaintext and ciphertext alphabets of various lengths. The device with which he did this was a disk, with two movable rings with alphabets. The letters and numbers of the outer ring were removable and could be assembled in any order. This cipher system implements a periodic polyalphabetic substitution.

(Slide 17) There are many ways to encode information.

The captain of the French army, CHARLES BARBIER, developed in 1819 the coding system ecriture noctrume - night writing. Convex dots and dashes were used in the system, the disadvantage of the system is its complexity, since it was not letters that were encoded, but sounds.

LOUIS BRAILE improved the system, developed his own cipher. The foundations of this system are still in use today.

(Slide 18) SAMUEL MORSE developed in 1838 a system for encoding characters using dots and dashes. He is also the inventor of the telegraph (1837) - a device that used this system. The most important thing in this invention is the binary code, that is, the use of only two characters to encode letters.

(Slide 19) Task "Check yourself"

(Slide 20) At the end of the 19th century, cryptography began to acquire the features of an exact science, and not just an art, it began to be studied in military academies. One of them developed its own military field cipher, called the Saint-Cyr Line. It made it possible to significantly increase the efficiency of the cryptographer's work, to facilitate the algorithm for implementing the Vigenère cipher. It is in this mechanization of encryption-decryption processes that the contribution of the authors of the line to practical cryptography lies.

In the history of cryptography of the XIX century. the name of AUGUST KIRKHOFFES was vividly imprinted. In the 80s of the XIX century, he published the book "Military Cryptography" with a volume of only 64 pages, but they immortalized his name in the history of cryptography. It formulates 6 specific requirements for ciphers, two of which relate to the strength of encryption, and the rest - to operational qualities. One of them (“compromising the system should not cause inconvenience to correspondents”) became known as the “Kerckhoffs rule”. All these requirements are relevant today.

In the 20th century, cryptography became electromechanical, then electronic. This means that electromechanical and electronic devices have become the main means of transmitting information.

(Slide 21) In the second half of the 20th century, following the development of the element base of computer technology, electronic encoders appeared. Today, it is electronic encoders that make up the vast majority of encryption tools. They meet the ever-increasing requirements for reliability and speed of encryption.

In the seventies, two events occurred that seriously influenced the further development of cryptography. Firstly, the first data encryption standard (DES) was adopted (and published!) which "legalized" the Kerckhoffs principle in cryptography. Secondly, after the work of the American mathematicians W. DIFFI and M. HELLMAN, a "new cryptography" was born - cryptography with a public key.

(Slide 22) Task "Check yourself"

(Slide 23) The role of cryptography will increase due to the expansion of its areas of application:

  • digital signature,
  • authentication and confirmation of the authenticity and integrity of electronic documents,
  • e-business security,
  • protection of information transmitted via the Internet, etc.

Familiarity with cryptography will be required for each user of electronic means of information exchange, therefore cryptography in the future will become the "third literacy" along with the "second literacy" - computer and information technology skills.

Solving the problem of determining the key by simply enumeration of all possible options is usually impractical, except for the use of a very short key. Therefore, if a cryptanalyst wants to have a real chance of cracking a cipher, he must abandon the "brute force" methods of enumeration and apply a different strategy. In the disclosure of many encryption schemes, statistical analysis can be applied using the frequency of occurrence of individual characters or their combinations. To complicate the solution of the problem of breaking the cipher using statistical analysis, K. Shannon proposed two concepts of encryption, called confusion (confusion) and diffusion (diffusion). Confusion is the application of substitution such that the relationship between the key and the ciphertext is made as complex as possible. The application of this concept complicates the use of statistical analysis, which narrows the key search area, and the decryption of even a very short sequence of a cryptogram requires a search of a large number of keys. In turn, diffusion is the application of such transformations that smooth out statistical differences between symbols and their combinations. As a result, the use of statistical analysis by a cryptanalyst can lead to a positive result only if a sufficiently large piece of ciphertext is intercepted.

The implementation of the goals proclaimed by these concepts is achieved through the repeated use of elementary encryption methods such as the method of substitution, permutation and scrambling.

10.4.1. Substitution method.

The simplest and the one with the longest history is the substitution method, the essence of which is that the character of the source text is replaced by another one selected from this or another alphabet according to the rule specified by the encryption key. The location of the character in the text does not change. One of the earliest examples of the use of the staging method is caesar cipher, which was used by Gaius Julius Caesar during his Gallic campaigns. In it, each letter of the plaintext was replaced by another, taken from the same alphabet, but cyclically shifted by a certain number of characters. The application of this encryption method is illustrated by the example shown in Figure 10.3, in which the encryption transformation is based on the use of an alphabet with a cyclic shift of five positions.

Rice. 10.3, a )

Source text

Cryptogram

Rice. 10.3, b )

Obviously, the cipher key is the value of the cyclic shift. If you choose a different key than specified in the example, the cipher will change.

Another example of a classical scheme based on the substitution method is the encryption system called polybius square. With regard to the Russian alphabet, this scheme can be described as follows. Initially combined into one letter E, Yo; I, Y and b, b, the true meaning of which in the deciphered text is easily restored from the context. Then 30 symbols of the alphabet are placed in a table of size 65, an example of filling which is shown in Fig. 10.4.

Rice. 10.4.

Encryption of any plaintext letter is done by specifying its address (i.e. row and column number or vice versa) in the given table. So, for example, the word CAESAR is encrypted using the Polybius square as 52 21 23 11 41 61. It is quite clear that the code can be changed as a result of permutations of the letters in the table. It should also be noted that those who attended a tour of the casemates of the Peter and Paul Fortress should remember the words of the guide about how the prisoners were knocking among themselves. Obviously, their way of communicating is completely covered by this encryption method.

An example of a polyalphabetic cipher is a scheme based on the so-called. progressive key of Trithemius. The basis of this encryption method is the table shown in Fig. 10.5, whose lines are cyclically shifted by one position copies of the original alphabet. Thus, the first line has a zero shift, the second is cyclically shifted one position to the left, the third is two positions relative to the first line, and so on.

Rice. 10.5.

One of the encryption methods using such a table is to use instead of the first character of the plaintext a character from the first cyclic shift of the source alphabet, standing under the character being encrypted, the second character of the plaintext from the string corresponding to the second cyclic shift, etc. An example of encrypting a message in this way is shown below (Figure 10.6).

plain text

Ciphertext

Rice. 10.6.

Several interesting variants of ciphers based on the Trithemius progressive key are known. In one of them, called Vigenere key method, a keyword is used that specifies the strings to encrypt and decrypt for each successive plaintext character: the first letter of the key specifies the row of the table in fig. 10.5, with which the first character of the message is encrypted, the second letter of the key specifies the row of the table that encrypts the second character of the plaintext, and so on. Let the word “THROMB” be chosen as the key, then the message encrypted using the Vigenere key can be represented as follows (Fig. 10.7). It is obvious that the opening of the key can be carried out on the basis of a statistical analysis of the ciphertext.

plain text

Ciphertext

Rice. 10.7.

A variation of this method is the so-called. automatic method (open) key Viginera, in which as generating key a single letter or word is used. This key gives the initial string or strings to encrypt the first or first few characters of the plaintext, similar to the previously discussed example. The plaintext characters are then used as the key to select the encryption string. In the example below, the letter "I" is used as the generating key (Fig. 10.8):

plain text

Ciphertext

Rice. 10.8.

As the example shows, the choice of cipher strings is completely determined by the content of the plaintext, i.e. feedback on the plaintext is introduced into the encryption process.

Another version of the Vigenere method is automatic method (encrypted) Vigenère's key. It, like public key encryption, also uses a generating key and feedback. The difference is that after encryption with a generating key, each subsequent key character in the sequence is taken not from the plaintext, but from the resulting cryptogram. Below is an example explaining the principle of applying this encryption method, in which, as before, the letter “I” is used as a generating key (Fig. 10.9):

plain text

Ciphertext

Rice. 10.9.

As can be seen from the above example, although each subsequent key symbol is determined by the cryptogram symbol preceding it, it is functionally dependent on all previous symbols of the open message and the generating key. Consequently, there is a scattering effect of the statistical properties of the source text, which makes it difficult for a cryptanalyst to apply statistical analysis. The weak link of this method is that the ciphertext contains the characters of the key.

By current standards, Vigenere encryption is not considered secure, but the main contribution is the discovery that non-repeating key sequences can be formed using either the messages themselves or functions from the messages.

A variant of the implementation of the substitution technology, which sufficiently implements the concept of mixing, is the following example, based on a non-linear transformation. The stream of information bits is preliminarily divided into blocks of length m, with each block being represented by one of a different symbol. Then a lot of
characters are shuffled so that each character is replaced by another character from this set. After the shuffling operation, the symbol turns back into m-bit block. A device that implements the described algorithm when
, shown in Fig. 10.10, where the table specifies the rule for mixing symbols of the set from
elements.

Rice. 10.10.

It is not difficult to show that there is
different permutations or related possible models. In connection with this, at large values m the task of the cryptanalyst becomes computationally almost impossible. For example, when
the number of possible substitutions is defined as
, i.e. is an astronomical number. Obviously, with such a value m this transformation with substitution block (substitution block, S-block) can be considered as having practical secrecy. However, its practical implementation is hardly possible, since it presupposes the existence
connections.

Let us now make sure that S is the block shown in Fig. 10.10, indeed performs a non-linear transformation, for which we use the principle of superpositions: transformation
is linear if. Let's pretend that
, a
. Then, a, whence it follows that S-block is non-linear.

10.4.2. The permutation method.

At permutation(or transpositions) in accordance with the key, the order of the plaintext characters is changed, while the meaning of the character is preserved. Permutation ciphers are block ciphers, i.e., the source text is preliminarily divided into blocks, in which the permutation specified by the key is carried out.

The simplest implementation of this encryption method can be the previously considered interleaving algorithm, the essence of which is to split the stream of information symbols into blocks of length
, writing it line by line into a memory matrix of size lines and columns and reading by columns. An example of this algorithm is
in fig. 10.11, during which a phrase is recorded X="Examination time will start soon." Then, at the output of the permutation device, a cryptogram of the form

Rice. 10.11.

The considered version of the permutation method can be complicated by introducing the keys
and
, which determine the order of writing rows and reading columns, respectively, as illustrated by the table in Fig. 10.12. The result of the transformation will look like this

Rice. 10.12.

On fig. 10.13 is an example of a binary permutation of data (linear operation), which shows that the data is simply shuffled or permuted. The transformation is carried out using the permutation block ( permutation block, P-block). The permutation technology implemented by this block has one major drawback: it is vulnerable to spoof messages. The fake message is shown in Fig. 10.13 and consists in supplying a single unit to the input with the remaining zeros, which allows you to detect one of the internal links. If a cryptanalyst needs to analyze such a scheme using a plaintext attack, then he will send a sequence of such deceptive messages, shifting a single unit by one position with each transmission. As a result of such an attack, all input and output connections will be established. This example demonstrates why the security of a circuit should not depend on its architecture.

10.4.3. Gamma method.

P attempts to approach perfect secrecy are demonstrated by many modern telecommunication systems using the scrambling operation. Under scrambling is understood as the process of superimposing codes of a random sequence of numbers on the codes of plaintext characters, which is also called gamma (after the name of the letter  of the Greek alphabet, used in mathematical formulas to denote a random process). Gambling refers to streaming encryption methods, when successive plaintext characters are sequentially converted into ciphertext characters, which increases the conversion speed. So, for example, the stream of information bits arrives at one input of the modulo 2 adder shown in Fig. 10.14, while the second one has a scrambling binary sequence
. Ideally the sequence
must be a random sequence with equally likely zeros and ones. Then the output encrypted stream
will be statistically independent of the information sequence
, which means that the sufficient condition for perfect secrecy will be satisfied. In fact, it's completely random.
is not necessary because otherwise the recipient would not be able to recover the plaintext. Indeed, the recovery of the plaintext on the receiving side should be carried out according to the rule
, so that exactly the same scrambling sequence and with the same phase must be generated at the receiving side. However, due to pure chance
this procedure becomes impossible.

In practice, pseudo-random sequences (RRPs), which can be reproduced on the receiving side, have found wide use as scrambling ones. Stream encryption technology usually uses a generator based on linear shift register with feedback (linear feedback shift register(LFSR)). The typical structure of the PSP generator shown in fig. 10.15, includes a shift register, which consists of – individual delay elements or bits having possible states and storing some field element
during the clock interval, a feedback circuit that includes multipliers of elements (states) stored in bits by constants , and adders. The formation of the PSS is described by a recursive relation of the form

where coefficients
are fixed constants belonging to
, according to which each next element of the sequence is calculated based on n previous ones.

Since the number of different register states is finite (at most ), the situation is inevitable when, after a certain number of cycles, the state will repeat itself in the form of one of the previous ones. However, starting from some initial load, i.e. fixed state, diagram in fig. 10.15 will only generate a single sequence defined by the mentioned recursion. Therefore, the repetition of the state of the register leads to the repetition of all subsequent generated symbols, which means that any SRP is periodic. Moreover, in the case of the zero state of the register (the presence of zeros in all digits), an infinite degenerate sequence will always be formed, consisting of only zeros. It is obvious that such a case is absolutely unpromising, so the zero state of the register should be excluded. As a result, no more
allowed states of the register, which limits the maximum possible period of the sequence to a value not greater than
.

Example 10.4.1. On fig. 10.16, a, the implementation of the generator based on the shift register with linear feedback, which forms a binary pseudo-random sequence of the period
. Note that in the case of a binary PRS, multiplying by one is equivalent to simply connecting the bit output to an adder. Rice. 10.16, b, illustrates successive contents of the register (bit states), as well as the states of the feedback output (OS point in the diagram) when clock pulses are applied. The sequence is read in the form of successive states of the extreme p right rank. Reading the states of other bits results in copies of the same sequence shifted by one or two cycles.

At first glance, it can be assumed that the use of a long-term memory bandwidth can provide a sufficiently high security. So, for example, in a cellular mobile communication system of the IS-95 standard, the PRP of the period
among elementary chips. With a chip rate of 1.228810 6 symbols/sec, its period is:

Therefore, it can be assumed that since the sequence does not repeat for such a long period, then it can be considered random and provide perfect secrecy. However, there is a fundamental difference between a pseudo-random sequence and a truly random sequence: a pseudo-random sequence is formed according to some algorithm. Thus, if the algorithm is known, then the sequence itself will be known. As a result of this feature, an encryption scheme using a linear feedback shift register is vulnerable to a known plaintext attack.

To determine the feedback taps, the initial state of the register and the entire sequence, it is enough for a cryptanalyst to have only
bits of the plaintext and their corresponding ciphertext. Obviously, the value 2 n much less than the PSP period equal to
. Let's illustrate the mentioned vulnerability with an example.

Example 10.4.2. Let the period SRP be used as the scrambling one
, generated using recursion of the form

at the initial state of the register 0001. As a result, the sequence will be formed. Let us assume that a cryptanalyst who knows nothing about the feedback structure of the PSP generator has managed to obtain
cryptogram bit and its public equivalent:

Then, adding both sequences modulo 2, the cryptanalyst gets at his disposal a fragment of the scrambling sequence, which shows the state of the shift register at different points in time. So, for example, the first four bits of the key sequence correspond to the state of the register at some point in time . If we now shift the window that selects four bits by one position to the right, then the states of the shift register will be obtained at successive points in time
. Given the linear structure of the feedback circuit, we can write that

where PSP symbol, which is generated by the feedback circuit and fed to the input of the first digit of the register, and
determines the presence or absence i-th connection between the bit output of the shift register and the adder, i.e. feedback scheme.

Analyzing the states of the shift register at four consecutive times, we can compose the following system of four equations with four unknowns:

The solution of this system of equations gives the following values ​​of the coefficients:

Thus, having determined the feedback circuit of the linear register and knowing its state at the moment of time , the cryptanalyst is able to reproduce the scrambling sequence at an arbitrary point in time, and therefore is able to decrypt the intercepted cryptogram.

Generalizing the considered example to the case of an arbitrary memory shift register n, the original equation can be represented as

,

and the system of equations is written in the following matrix form

,

where
, a
.

It can be shown that the columns of the matrix are linearly independent, and hence there is an inverse matrix
. Consequently

.

Matrix inversion requires order operations, so
we have
that for a computer with a speed of operation, one operation for 1 μs will require 1 second to reverse the matrix. Obviously, the weakness of the shift register is due to the linearity of the feedback.

To make it difficult for an analyst to calculate the elements of the PSP when comparing fragments of the plaintext and encryption, feedback on the output and ciphertext is used. On fig. 10.17 explains the principle of introducing ciphertext feedback.

Rice. 10.17. Stream Encryption with Feedback.

First, a preamble is transmitted, which contains information about the parameters of the generated SRP, including the value of the initial phase Z 00 . For each n generated ciphergram symbols, a new phase value is calculated and set in the generator
. Feedback makes the gamma method sensitive to cryptogram distortions. So, due to interference in the communication channel, some received symbols may be distorted, which will lead to the calculation of an erroneous value of the PRS phase and make further decoding difficult, but after receiving n correct ciphertext characters the system is restored. At the same time, such a distortion can be explained by an attacker's attempt to impose false data.

The problem of theft of personal data has quietly turned into a scourge of civilization. Information about the user is pulled by all and sundry: someone who has previously asked for consent (social networks, operating systems, computer and mobile applications), others without permission and demand (malicious criminals of all kinds and entrepreneurs who derive any benefit from information about a particular person). In any case, there is little pleasant and there is always a risk that, along with harmless information, something will fall into the wrong hands that can harm you personally or your employer: official documents, private or business correspondence, family photos ...

But how to prevent leaks? A tinfoil hat will not help here, although this is undoubtedly a beautiful solution. But total data encryption will help: by intercepting or stealing encrypted files, the spy will not understand anything in them. You can do this by protecting all your digital activity with the help of strong cryptography (strong ciphers are ciphers that, with existing computer power, will take time to break, at least longer than a person's lifespan). Here are 6 practical recipes that will help you solve this problem.

Encrypt your web browser activity. The global network is designed in such a way that your request even to closely located sites (such as yandex.ru) passes on its way through many computers (“nodes”) that relay it back and forth. You can view an approximate list of them by typing tracert site_address in the command line. The first in such a list will be your Internet service provider or the owner of the Wi-Fi access point through which you connected to the Internet. Then some more intermediate nodes, and only at the very end is the server on which the site you need is stored. And if your connection is not encrypted, that is, it is conducted using the usual HTTP protocol, everyone who is between you and the site will be able to intercept and analyze the transmitted data.

So do a simple thing: add an "s" to "http" in the address bar so that the site address starts with "https://". This way you enable traffic encryption (the so-called SSL / TLS security layer). If the site supports HTTPS, it will allow it. And in order not to suffer every time, install a browser plugin: it will forcefully try to enable encryption on every site you visit.

Flaws: the eavesdropper will not be able to know the meaning of the transmitted and received data, but he will know that you visited a particular site.

Encrypt your email. Letters sent by e-mail also go through intermediaries before reaching the addressee. By encrypting, you will prevent the spy from understanding their contents. However, the technical solution here is more complicated: you will need to use an additional program for encryption and decryption. The classic solution, which has not lost its relevance so far, will be the OpenPGP package or its free counterpart GPG, or a browser plug-in that supports the same encryption standards (for example, Mailvelope).

Before starting a correspondence, you generate a so-called public crypto key that can be used to “close” (encrypt) letters addressed to you, your recipients. In turn, each of your recipients must also generate their own key: with the help of other people's keys, you can “close” letters for their owners. In order not to get confused with the keys, it is better to use the aforementioned browser plugin. A letter "closed" by a crypto key turns into a set of meaningless characters - and only the owner of the key can "open" it (decrypt it).

Flaws: when starting a correspondence, you must exchange keys with your correspondents. Try to ensure that no one can intercept and change the key: pass it from hand to hand, or publish it on a public key server. Otherwise, by replacing your key with your own, the spy will be able to deceive your correspondents and be aware of your correspondence (the so-called man in the middle attack).

Encrypt instant messages. The easiest way is to use instant messengers that already know how to encrypt correspondence: Telegram, WhatsApp, Facebook Messenger, Signal Private Messenger, Google Allo, Gliph, etc. In this case, you are protected from prying eyes from outside: if a random person intercepts the messages, he will see only a hodgepodge of characters. But this will not protect you from the curiosity of the company that owns the messenger: companies, as a rule, have keys that allow you to read your correspondence - and not only do they like to do it themselves, they will hand them over to law enforcement agencies on demand.

Therefore, the best solution would be to use some popular free (open source) messenger with a plug-in for on-the-fly encryption (such a plug-in is often called “OTR”: off the record - preventing recording). Pidgin would be a good choice.

Flaws: As with email, you are not guaranteed against a man-in-the-middle attack.


Encrypt documents in the cloud. If you use "cloud" storage like Google Drive, Dropbox, OneDrive, iCloud, your files can be stolen by someone who peeps (or guesses) your password, or if some kind of vulnerability is found in the service itself. Therefore, before you put anything in the "cloud", encrypt it. It is easiest and most convenient to implement such a scheme with the help of a utility that creates a folder on the computer - documents placed where are automatically encrypted and forwarded to the "cloud" disk. Such is, for example, Boxcryptor. It is a little less convenient to use applications like TrueCrypt for the same purpose - they create an entire encrypted volume hosted in the "cloud".

Flaws: none.


Encrypt all (not just browser) traffic from your computer. It can come in handy if you are forced to use an unverified open Internet connection - for example, unencrypted Wi-Fi in a public place. Here it is worth using a VPN: somewhat simplifying, this is an encrypted channel stretched from you to the VPN provider. On the provider's server, the traffic is decrypted and sent further to its destination. VPN providers are both free (VPNbook.com, Freevpn.com, CyberGhostVPN.com) and paid ones - differing in access speed, session time, etc. The big bonus of such a connection is that to the whole world you appear to be accessing the Web from the VPN server, and not from your computer. Therefore, if the VPN provider is located outside the Russian Federation, you will be able to access sites blocked inside the Russian Federation.

The same result can be achieved if you install TOR on your computer - with the only difference that in this case there is no provider: you will access the Internet through random nodes belonging to other members of this network, that is, persons or organizations unknown to you.

Flaws: remember that your traffic is decrypted at the exit node, i.e. the server of the VPN provider or the computer of a random TOR participant. Therefore, if their owners wish, they will be able to analyze your traffic: try to intercept passwords, extract valuable information from correspondence, etc. Therefore, when using VPN or TOR, combine them with other encryption tools. In addition, setting up TOR correctly is not an easy task. If you have no experience, it is better to use a ready-made solution: the TOR kit + Firefox browser (in this case, only browser traffic will be encrypted) or the Tails Linux distribution (working from a CD or flash drive), where all traffic is already configured to route through TOR .

Encrypt flash drives and removable media, mobile devices. You can also add encryption of the hard drive on a working computer, but at least you don’t risk losing it - the likelihood of which is always present in the case of portable drives. To encrypt not a single document, but an entire disk at once, use BitLocker (built into MS Windows), FileVault (built into OS X), DiskCryptor, 7-Zip and the like. Such programs work "transparently", that is, you will not notice them: files are encrypted and decrypted automatically, "on the fly". However, an attacker who gets into the hands of a flash drive closed with their help, for example, will not be able to extract anything from it.

As for smartphones and tablets, it is better to use the built-in functionality of the operating system for full encryption. On Android devices, look in "Settings -> Security", on iOS devices in "Settings -> Password".

Flaws: since all data is now stored in encrypted form, the processor has to decrypt it when reading and encrypt it when writing, which, of course, wastes time and energy. Therefore, the drop in performance can be noticeable. How much your digital device will actually slow down depends on its specifications. In general, more modern and top models will perform better.


This is a list of actions to take if you are concerned about the possible leakage of files into the wrong hands. But apart from that, there are a few more general considerations that should also be kept in mind:

A free privacy app is usually more secure than a proprietary one. Free is one whose source code is published under a free license (GNU GPL, BSD, etc.) and can be changed by anyone. Proprietary - such, the exclusive rights to which belong to any one company or developer; the source code of such programs is usually not published.

Encryption involves the use of passwords, so make sure your password is correct: long, random, varied.

Many office applications (text editors, spreadsheets, etc.) can encrypt their documents on their own. However, the strength of the ciphers used by them is usually low. Therefore, for protection, it is better to prefer one of the universal solutions listed above.

For tasks that require anonymity/privacy, it is more convenient to keep a separate browser set to "paranoid" mode (like the aforementioned Firefox + TOR bundle).

Javascript, often used on the Web, is a real find for a spy. Therefore, if you have something to hide, it is better to block Javascript in your browser settings. Also, unconditionally block ads (install any plugin that implements this function, for example, AdBlockPlus): lately, malicious code has been often sent under the guise of banners.

If the notorious “Yarovaya law” nevertheless comes into force (according to the plan, this should happen on July 1, 2018), spare keys for all ciphers in Russia will have to be transferred to the state, otherwise the cipher will not be certified. And for using uncertified encryption, even ordinary smartphone owners can be fined in the amount of 3 thousand rubles with confiscation of the digital device.

P.S. This article uses a photograph by Christiaan Colen .

If you liked the article - recommend it to your friends, acquaintances or colleagues related to the municipal or public service. We think that it will be both useful and pleasant for them.
When reprinting materials, a link to the source is required.

The need for encryption of correspondence arose in the ancient world, and simple substitution ciphers appeared. Encrypted messages determined the fate of many battles and influenced the course of history. Over time, people invented more and more advanced encryption methods.

Code and cipher are, by the way, different concepts. The first means replacing each word in the message with a code word. The second is to encrypt each symbol of information using a specific algorithm.

After the coding of information was taken up by mathematics and the theory of cryptography was developed, scientists discovered many useful properties of this applied science. For example, decoding algorithms have helped unravel dead languages ​​such as ancient Egyptian or Latin.

Steganography

Steganography is older than coding and encryption. This art has been around for a very long time. It literally means "hidden writing" or "cipher writing". Although steganography does not quite meet the definitions of a code or cipher, it is intended to hide information from prying eyes.

Steganography is the simplest cipher. Swallowed notes covered in wax are typical examples, or a message on a shaved head that hides under grown hair. The clearest example of steganography is the method described in many English (and not only) detective books, when messages are transmitted through a newspaper, where letters are inconspicuously marked.

The main disadvantage of steganography is that an attentive stranger can notice it. Therefore, in order to prevent the secret message from being easily read, encryption and coding methods are used in conjunction with steganography.

ROT1 and Caesar cipher

The name of this cipher is ROTate 1 letter forward, and it is known to many schoolchildren. It is a simple substitution cipher. Its essence lies in the fact that each letter is encrypted by shifting alphabetically by 1 letter forward. A -\u003e B, B -\u003e C, ..., Z -\u003e A. For example, we encrypt the phrase "our Nastya cries loudly" and we get "general Obtua dspnlp rmbsheu".

The ROT1 cipher can be generalized to an arbitrary number of offsets, then it is called ROTN, where N is the number by which the letter encryption should be offset. In this form, the cipher has been known since ancient times and is called the "Caesar cipher".

The Caesar cipher is very simple and fast, but it is a simple single permutation cipher and therefore easy to break. Having a similar disadvantage, it is suitable only for children's pranks.

Transposition or permutation ciphers

These types of simple permutation ciphers are more serious and were actively used not so long ago. During the American Civil War and World War I, it was used to send messages. His algorithm consists in rearranging the letters in places - write the message in reverse order or rearrange the letters in pairs. For example, let's encrypt the phrase "Morse code is also a cipher" -> "akubza ezrom - ezhot rfish".

With a good algorithm that determined arbitrary permutations for each character or group of them, the cipher became resistant to simple breaking. But! Only in due time. Since the cipher is easily broken by simple brute force or dictionary matching, today any smartphone can handle its decryption. Therefore, with the advent of computers, this cipher also passed into the category of children's.

Morse code

The alphabet is a means of information exchange and its main task is to make messages simpler and more understandable for transmission. Although this is contrary to what encryption is intended for. Nevertheless, it works like the simplest ciphers. In the Morse system, each letter, number, and punctuation mark has its own code, made up of a group of dashes and dots. When transmitting a message using the telegraph, dashes and dots mean long and short signals.

The telegraph and the alphabet was the one who first patented "his" invention in 1840, although similar devices were invented in Russia and England before him. But who cares now ... The telegraph and Morse code had a very great impact on the world, allowing almost instantaneous transmission of messages over continental distances.

Monoalphabetic substitution

The ROTN and Morse code described above are examples of monoalphabetic replacement fonts. The prefix "mono" means that during encryption, each letter of the original message is replaced by another letter or code from a single encryption alphabet.

Simple substitution ciphers are not difficult to decipher, and this is their main drawback. They are guessed by simple enumeration or For example, it is known that the most used letters of the Russian language are “o”, “a”, “i”. Thus, it can be assumed that in the ciphertext the letters that occur most often mean either "o", or "a", or "and". Based on such considerations, the message can be decrypted even without a computer enumeration.

It is known that Mary I, Queen of Scots from 1561 to 1567, used a very complex monoalphabetic substitution cipher with several combinations. Yet her enemies were able to decipher the messages, and the information was enough to sentence the queen to death.

Gronsfeld cipher, or polyalphabetic substitution

Simple ciphers are declared useless by cryptography. Therefore, many of them have been improved. The Gronsfeld cipher is a modification of the Caesar cipher. This method is much more resistant to hacking and lies in the fact that each character of the encoded information is encrypted using one of the different alphabets, which are repeated cyclically. We can say that this is a multidimensional application of the simplest substitution cipher. In fact, the Gronsfeld cipher is very similar to the one discussed below.

ADFGX encryption algorithm

This is the most famous World War I cipher used by the Germans. The cipher got its name because the encryption algorithm led all ciphergrams to the alternation of these letters. The choice of the letters themselves was determined by their convenience when transmitted over telegraph lines. Each letter in the cipher is represented by two. Let's look at a more interesting version of the ADFGX square that includes numbers and is called ADFGVX.

A D F G V X
A J Q A 5 H D
D 2 E R V 9 Z
F 8 Y I N K V
G U P B F 6 O
V 4 G X S 3 T
X W L Q 7 C 0

The ADFGX squaring algorithm is as follows:

  1. We take random n letters to designate columns and rows.
  2. We build an N x N matrix.
  3. We enter into the matrix the alphabet, numbers, signs, randomly scattered over the cells.

Let's make a similar square for the Russian language. For example, let's create a square ABCD:

BUT B AT G D
BUT HER H b/b BUT I/Y
B H V/F G/K W D
AT W/W B L X I
G R M O YU P
D AND T C S At

This matrix looks strange, because a row of cells contains two letters. This is acceptable, the meaning of the message is not lost. It can be easily restored. Let's encrypt the phrase "Compact cipher" using this table:

1 2 3 4 5 6 7 8 9 10 11 12 13 14
Phrase To O M P BUT To T H S Y W And F R
Cipher bv guards gb where ag bv db ab dg hell wa hell bb ha

Thus, the final encrypted message looks like this: “bvgvgbgdagbvdbabdgvdvaadbbga”. Of course, the Germans carried out a similar line through several more ciphers. And as a result, an encrypted message that was very resistant to hacking was obtained.

Vigenère cipher

This cipher is an order of magnitude more resistant to cracking than monoalphabetic ones, although it is a simple text replacement cipher. However, due to the robust algorithm, it was long considered impossible to hack. The first mention of it dates back to the 16th century. Vigenère (a French diplomat) is erroneously credited as its inventor. To better understand what is at stake, consider the Vigenère table (Vigenère square, tabula recta) for the Russian language.

Let's proceed to encrypt the phrase "Kasperovich laughs." But for encryption to succeed, you need a keyword - let it be "password". Now let's start encryption. To do this, we write the key so many times that the number of letters from it corresponds to the number of letters in the encrypted phrase, by repeating the key or cutting:

Now, as in the coordinate plane, we are looking for a cell that is the intersection of pairs of letters, and we get: K + P \u003d b, A + A \u003d B, C + P \u003d C, etc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Cipher: Kommersant B AT YU FROM H YU G SCH AND E Y X AND G BUT L

We get that "Kasperovich laughs" = "bvusnyugshzh eihzhgal".

Breaking the Vigenère cipher is so difficult because for frequency analysis to work, you need to know the length of the keyword. So the hack is to throw the length of the keyword at random and try to crack the secret message.

It should also be mentioned that in addition to a completely random key, a completely different Vigenère table can be used. In this case, the Vigenère square consists of a line-by-line written Russian alphabet with a shift of one. Which refers us to the ROT1 cipher. And just like in the Caesar cipher, the offset can be anything. Moreover, the order of the letters does not have to be alphabetical. In this case, the table itself can be the key, without knowing which it will be impossible to read the message, even knowing the key.

Codes

Real codes consist of matches for each word of a separate code. To work with them, so-called code books are needed. In fact, this is the same dictionary, only containing translations of words into codes. A typical and simplified example of codes is the ASCII table - an international cipher of simple characters.

The main advantage of codes is that they are very difficult to decipher. Frequency analysis almost does not work when they are hacked. The weakness of the codes is, in fact, the books themselves. First, their preparation is a complex and expensive process. Secondly, for enemies they turn into a desired object and the interception of even a part of the book forces you to change all the codes completely.

In the 20th century, many states used codes to transfer secret data, changing the code book after a certain period. And they actively hunted for the books of neighbors and opponents.

"Enigma"

Everyone knows that the Enigma was the main cipher machine of the Nazis during World War II. Enigma's structure includes a combination of electrical and mechanical circuits. How the cipher will turn out depends on the initial configuration of Enigma. At the same time, Enigma automatically changes its configuration during operation, encrypting one message in several ways throughout its entire length.

In contrast to the simplest ciphers, Enigma gave trillions of possible combinations, which made breaking the encrypted information almost impossible. In turn, the Nazis had a certain combination prepared for each day, which they used on a particular day to transmit messages. So even if the Enigma fell into the hands of the enemy, it did nothing to decipher the messages without entering the right configuration every day.

They actively tried to crack the Enigma during the entire military campaign of Hitler. In England, in 1936, one of the first computing devices (Turing machine) was built for this, which became the prototype of computers in the future. His task was to simulate the operation of several dozen Enigmas simultaneously and run intercepted Nazi messages through them. But even Turing's machine was only occasionally able to crack the message.

Public key encryption

The most popular of which is used everywhere in technology and computer systems. Its essence lies, as a rule, in the presence of two keys, one of which is transmitted publicly, and the second is secret (private). The public key is used to encrypt the message, and the private key is used to decrypt it.

The public key is most often a very large number, which has only two divisors, not counting the unit and the number itself. Together, these two divisors form a secret key.

Let's consider a simple example. Let the public key be 905. Its divisors are the numbers 1, 5, 181 and 905. Then the secret key will be, for example, the number 5*181. Are you saying too easy? What if the public number is a number with 60 digits? It is mathematically difficult to calculate the divisors of a large number.

As a more realistic example, imagine you are withdrawing money from an ATM. When reading the card, personal data is encrypted with a certain public key, and on the bank's side, the information is decrypted with a secret key. And this public key can be changed for each operation. And there are no ways to quickly find key divisors when it is intercepted.

Font Persistence

The cryptographic strength of an encryption algorithm is the ability to resist hacking. This parameter is the most important for any encryption. Obviously, the simple substitution cipher, which can be decrypted by any electronic device, is one of the most unstable.

To date, there are no uniform standards by which it would be possible to assess the strength of the cipher. This is a laborious and long process. However, there are a number of commissions that have produced standards in this area. For example, the minimum requirements for the Advanced Encryption Standard or AES encryption algorithm, developed by NIST USA.

For reference: the Vernam cipher is recognized as the most resistant cipher to breaking. At the same time, its advantage is that, according to its algorithm, it is the simplest cipher.