Standard ciphers and codes. Codes and ciphers for a super spy

My memories from childhood + imagination were enough for exactly one quest: a dozen tasks that are not duplicated.
But the children liked the fun, they asked for more quests and had to go online.
This article will not describe the script, legends, or design. But there will be 13 ciphers to encode the tasks for the quest.

Code number 1. Picture

A drawing or photo that directly indicates the place where the next clue is hidden, or a hint at it: broom + socket = vacuum cleaner
Complication: make a puzzle by cutting the photo into several parts.


Code 2. Leapfrog.

Swap the letters in the word: SOFA = NIDAV

Cipher 3. Greek alphabet.

Encode the message using the letters of the Greek alphabet, and give the children the key:

Code 4. Vice versa.

Write the assignment backwards:

  • every word:
    Etishchi dalk extra Jonsos
  • or an entire sentence, or even a paragraph:
    Etsem morkom momas v - akzaksdop yaaschuudelS. itup monrev an yv

Code 5. Mirror.

(when I did the quest for my children, at the very beginning I gave them a “magic bag”: there was a key to the “Greek alphabet”, a mirror, “windows”, pens and sheets of paper, and all sorts of unnecessary things for confusion. Finding another riddle, they had to figure out for themselves what from the bag would help them find the answer)

Code 6. Rebus.

The word is encoded in pictures:



Cipher 7. Next letter.

We write a word, replacing all the letters in it with the following ones in alphabetical order (then I is replaced by A, in a circle). Or the previous ones, or the next ones after 5 letters :).

CABINET = SHLBH

Code 8. Classics to the rescue.

I took a poem (and told the children which one) and a code of 2 numbers: line number number of letters in the line.

Example:

Pushkin "Winter Evening"

The storm covers the sky with darkness,
Whirling snow whirlwinds;
Then, like a beast, she will howl,
Then he will cry like a child,
Then on the dilapidated roof
Suddenly the straw will rustle,
The way a belated traveler
There will be a knock on our window.

21 44 36 32 82 82 44 33 12 23 82 28

Did you read it, where is the hint? :)

Code 9. Dungeon.

Write the letters in a 3x3 grid:

Then the word WINDOW is encrypted like this:

Code 10. Labyrinth.

My children liked this code; it is unlike the others, because it is not so much for the brain as for attention.

So:

On a long thread/rope you attach the letters in order, as they appear in the word. Then you stretch the rope, twist it and entangle it in every possible way between the supports (trees, legs, etc.). Having walked along the thread, as if through a maze, from the first letter to the last, the children will recognize the clue word.

Imagine if you wrap one of the adult guests in this way!
Children read - The next clue is on Uncle Vasya.
And they run to feel Uncle Vasya. Eh, if he is also afraid of tickles, then everyone will have fun!

Code 11. Invisible ink.

Use a wax candle to write the word. If you paint over the sheet with watercolors, you can read it.
(there are other invisible inks... milk, lemon, something else... But I only had a candle in my house :))

Code 12. Rubbish.

The vowels remain unchanged, but the consonants change according to the key.
For example:
SHEEPS SCHOMOSKO
reads as - VERY COLD, if you know the key:
D L X N H
Z M SCH K V

Code 13. Windows.

The kids loved it incredibly! They then used these windows to encrypt messages to each other all day long.
So: on one sheet of paper we cut out windows, as many as there are letters in the word. This is a stencil, we apply it to clean slate and “in the windows” we write a clue word. Then we remove the stencil and write many different unnecessary letters on the remaining blank space of the sheet. You can read the code if you attach a stencil with windows.
The children were at first stupefied when they found a sheet covered with letters. Then we twisted the stencil back and forth, we still need it right side attach!

Code 14. Map, Billy!

Draw a map and mark (X) the location with the treasure.
When I did the quest for mine for the first time, I decided that the map was very simple for them, so I needed to make it more mysterious (then it turned out that just a map would be enough for the children to get confused and run in the opposite direction)...

This is the map of our street. Hints here are house numbers (to understand that this is actually our street) and huskies. This dog lives with a neighbor across the street.
The children did not immediately recognize the area and asked me leading questions..
Then 14 children took part in the quest, so I united them into 3 teams. They had 3 versions of this map and each one had its own place marked. As a result, each team found one word:
"SHOW" "FAIRY TALE" "TURNIP"
It was next task:). He left behind some hilarious photos!
For my son’s 9th birthday, I didn’t have time to invent a quest, so I bought it on the MasterFuns website.. At my own peril and risk, because the description there is not very good.
But my children and I liked it because:
  1. inexpensive (similar to about 4 dollars per set)
  2. quickly (paid - downloaded, printed - everything took 15-20 minutes)
  3. There are a lot of tasks, with plenty to spare. And although I didn’t like all the riddles, there was plenty to choose from, and you could enter your own task
  4. everything is decorated in the same monster style and this gives the holiday effect. In addition to the quest tasks themselves, the kit includes: a postcard, flags, table decorations, and invitations to guests. And it's all about monsters! :)
  5. In addition to the 9-year-old birthday boy and his friends, I also have a 5-year-old daughter. The tasks were beyond her, but she and her friend also found entertainment - 2 games with monsters, which were also in the set. Phew, in the end - everyone is happy!

Please complain to me anai iptografiyakrai sai ikihauvai! Whether you're writing notes to your friends in class or trying to learn cryptography for fun, this article can help you learn some basic principles and create your own own way private message encodings. Read step 1 below to see where to start!


Some people use the words "code" and "cipher" to mean the same thing, 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 your code book, write your message carefully and carefully. Please 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 you are using double security.

    Code book

    Police coding

    Ciphers

    Date-based encryption

    1. Select a date. For example, it would be Steven Spielberg's birthday on December 16th, 1946. Write this date using numbers and slashes (12/18/46), then remove the slashes 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 films.” Under the message, 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 letter of normal text by the number of units indicated below it. The letter "M" is shifted one unit and becomes "N", the letter "N" is shifted 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 chukgmsyo tsyuekseb.”

      Translate your message. When someone wants to read your message, all they need to know is what date you used for encoding. To convert, use reverse process: Write the number code, then return the letters in the opposite order.

      • Encoding using a date has the added benefit of allowing the date to be anything. You can also change the date at any time. This allows the cipher system to be updated much more easily than using other methods. Be that as it may, it is better to avoid such known dates like May 9, 1945.

    Encryption using 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 has been blown” would look like this:

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

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

    Graphic cipher

    Caesar's Reshuffle

    Secret languages

    Confused language

    Sound code

    Gibberish language

    • 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, put the pen back together, find a location (like a pencil holder) and tell the recipient the location and type of pen.
    • Encrypt spaces as well to further confuse the code. For example, you can use letters (E, T, A, O, and H work best) instead of spaces. They are called pacifiers. ы, ъ, ь and й will look too obvious to experienced codebreakers, so don't use them or other prominent symbols.
    • You can create your own code by rearranging the letters in words in random order. “Dizh yaemn v krapa” - “Wait for me in the park.”
    • Always send codes to agents on your side.
    • When using Turkish Irish you do not need to specifically use "eb" before a consonant. You can use "ee", "br", "iz" or any other inconspicuous combination of letters.
    • When using positional encoding, feel free to add, remove, or even move letters from one place to another to make deciphering even more difficult. Make sure your partner understands what you are doing or the whole thing will be meaningless to her/him. You can break the text into sections so that there are three, four or five letters in each, and then swap them around.
    • For the Caesar rearrangement, you can rearrange the letters as many places as you want, forward or backward. Just make sure that the permutation rules are the same for each letter.
    • Always destroy decrypted messages.
    • If you use your own code, don't make it too complex that others won't be able to figure it out. It may be too difficult even for you to decipher!
    • 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 sloppily, it will make the decoding process more difficult for your partner, as long as you do not use variations of codes or ciphers designed specifically to confuse the codebreaker (except for your partner, of course).
    • Confused language is best used for short words. WITH in long words it's not as effective because the extra letters are much more noticeable. The same is true when using it in speech.

The need to encrypt correspondence arose back in 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 every word in the message with a code word. The second is encryption by a specific algorithm each character of information.

After mathematics began encoding information and the theory of cryptography was developed, scientists discovered many useful properties of this applied science. For example, decoding algorithms helped solve dead languages, such as ancient Egyptian or Latin.

Steganography

Steganography is older than coding and encryption. This art appeared a long time ago. It literally means “hidden writing” or “secret writing.” Although steganography does not exactly correspond to the definition of a code or cipher, it is intended to hide information from prying eyes.

Steganography is the simplest cipher. Typical examples are swallowed notes covered with wax, or a message on a shaved head that is hidden under the growth of hair. The clearest example Steganography is a method described in many English (and not only) detective books, when messages are transmitted through a newspaper, where letters are marked in an inconspicuous way.

The main disadvantage of steganography is that an attentive outsider can notice it. Therefore, to prevent the secret message from being easily read, encryption and encoding 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 is that each letter is encrypted by shifting the alphabet 1 letter forward. A -> B, B -> B, ..., I -> A. For example, let’s encrypt the phrase “our Nastya is crying loudly” and get “obshb Obtua dspnlp rmbsheu”.

The ROT1 cipher can be generalized to arbitrary number 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 is therefore easy to break. Having a similar drawback, it is only suitable for children's pranks.

Transposition or permutation ciphers

These types of simple permutation ciphers are more serious and have been actively used not so long ago. IN Civil War in the USA and in the First World War it was used to transmit messages. Its algorithm is to rearrange the letters - 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 hacking. But! Only in due time. Since the cipher can be easily cracked by simple brute force or dictionary matching, today any smartphone can decipher it. Therefore, with the advent of computers, this cipher also became a children's code.

Morse code

The alphabet is a means of exchanging information 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 represent long and short signals.

The telegraph and alphabet was the one who was the first to patent “his” invention in 1840, although similar devices had been invented before him in both Russia and England. But who cares now... The telegraph and Morse code had a very great influence on the world, allowing almost instantaneous transmission of messages over continental distances.

Monoalphabetic substitution

ROTN and Morse code described above are representatives 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.

Decryption of simple substitution ciphers is not difficult, and this is their main drawback. They can be solved by simply searching or For example, it is known that the most used letters in the Russian language are “o”, “a”, “i”. Thus, we can assume that in the ciphertext, the letters that appear most often mean either “o”, “a”, or “i”. Based on these considerations, the message can be deciphered even without computer search.

Mary I, Queen of Scots from 1561 to 1567, is known to have used a very complex monoalphabetic substitution cipher with multiple 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 considered useless by cryptography. Therefore, many of them have been modified. The Gronsfeld cipher is a modification of the Caesar cipher. This method is much more resistant to hacking and consists in the fact that each character of the encoded information is encrypted using one of 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 cipher World War I, used by the Germans. The cipher got its name because the encryption algorithm led all ciphergrams to alternate 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 algorithm for composing the ADFGX square is as follows:

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

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

A B IN G D
A HER N b/b A I/Y
B H V/F H/C Z D
IN Sh/Shch B L X I
G R M ABOUT YU P
D AND T C Y U

This matrix looks strange, since a number of cells contain 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 ABOUT M P A TO T N Y Y Sh AND F R
Cipher bv guards GB gd ah bv db ab dg hell va hell bb ha

Thus, the final encrypted message looks like this: “bvgvgbgdagbvdbabdgvdvaadbbga.” Of course, the Germans ran a similar line through several more ciphers. And the result was a very hack-resistant encrypted message.

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, thanks to the robust algorithm for a long time was considered impossible to hack. Its first mentions date back to the 16th century. Vigenère (a French diplomat) is mistakenly considered its inventor. To better understand what we're talking about, consider the Vigenère table (Vigenère square, tabula recta) for the Russian language.

Let's start encrypting the phrase “Kasperovich laughs.” But for encryption to succeed, you need keyword- let it be “password”. Now let's start encryption. To do this, we write down 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 it off:

Now how about coordinate plane, we look for a cell that is the intersection of pairs of letters, and we get: K + P = b, A + A = B, C + P = B, etc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Cipher: Kommersant B IN YU WITH N YU G SCH AND E Y X AND G A L

We get that “Kasperovich laughs” = “abvyusnyugshch eykhzhgal.”

Breaking the Vigenère cipher is so difficult because frequency analysis requires knowing the length of the keyword for it to work. Therefore, hacking involves randomly throwing in the length of a keyword and trying to crack the secret message.

It should also be mentioned that in addition to a completely random key, a completely random key can be used different table Vigenère. IN in this case The Vigenère square consists of the Russian alphabet written line by line with an offset of one. Which brings 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 may be a key, without knowing which it will be impossible to read the message, even knowing the key.

Codes

Real codes consist of correspondences for each word of a separate code. To work with them, you need so-called code books. 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 - the international cipher of simple characters.

The main advantage of codes is that they are very difficult to decipher. Frequency analysis almost doesn't work when hacking them. The weakness of the codes is, in fact, the books themselves. Firstly, their preparation is a complex and expensive process. Secondly, for enemies they turn into a desired object, and intercepting even part of the book forces them to change all the codes completely.

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

"Enigma"

Everyone knows that Enigma is the main encryption machine Nazis during World War II. The Enigma structure includes a combination of electrical and mechanical circuits. How the cipher turns out depends on the initial configuration of the 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 most simple ciphers Enigma gave trillions possible combinations, which made breaking encrypted information almost impossible. In turn, the Nazis had prepared for every day certain combination, which they used on a particular day to transmit messages. Therefore, even if Enigma fell into the hands of the enemy, it did not contribute in any way to deciphering messages without entering the necessary configuration every day.

They actively tried to break Enigma throughout Hitler's military campaign. In England in 1936, one of the first computing devices (Turing machine) was built for this purpose, 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 the Turing machine was only occasionally able to crack a 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 secret key is used to decrypt it.

The role of the public key is most often played by a very big number, which has only two divisors, not counting one and the number itself. Together, these two divisors form the secret key.

Let's look at 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. Would you say it's too simple? What if the public number is a number with 60 digits? It is mathematically difficult to calculate the divisors of a large number.

For a more realistic example, imagine you are withdrawing money from an ATM. When a card is read, 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. But there are no ways to quickly find key dividers when intercepting it.

Font durability

The cryptographic strength of an encryption algorithm is its ability to resist hacking. This parameter is the most important for any encryption. It is obvious that a simple substitution cipher that anyone can decipher electronic device, is one of the most unstable.

Doesn't exist today common standards, by which the strength of the cipher could be assessed. This is a labor-intensive and long process. However, there are a number of commissions that have produced standards in this area. For example, minimum requirements to 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 crack. At the same time, its advantage is that, according to its algorithm, it is the simplest cipher.

In substitution ciphers (or substitution ciphers), unlike, the elements of the text do not change their sequence, but change themselves, i.e. the original letters are replaced with other letters or symbols (one or more) according to certain rules.

This page describes ciphers in which the replacement occurs with letters or numbers. When the replacement occurs with some other non-alphanumeric characters, with combinations of characters or pictures, it is called direct.

Monoalphabetic ciphers

In monoalphabetic substitution ciphers, each letter is replaced by one and only one other letter/symbol or group of letters/symbols. If there are 33 letters in the alphabet, then there are 33 replacement rules: what to change A to, what to change B to, etc.

Such ciphers are quite easy to decipher even without knowing the key. This is done using frequency analysis ciphertext - you need to count how many times each letter appears in the text, and then divide by total number letters The resulting frequency must be compared with the reference one. The most common letter for the Russian language is the letter O, followed by E, etc. True, frequency analysis works on large literary texts. If the text is small or very specific in terms of the words used, then the frequency of letters will differ from the standard, and more time will have to be spent on solving. Below is a table of the frequency of letters (that is, the relative frequency of letters found in the text) of the Russian language, calculated on the basis of NKRY.

The use of frequency analysis to decrypt encrypted messages is beautifully described in many literary works, for example, in Arthur Conan Doyle's novel "" or Edgar Allan Poe's "".

It is easy to create a code table for a monoalphabetic substitution cipher, but it is quite difficult to remember it and, if lost, it is almost impossible to restore it, so they usually come up with some rules for compiling such code pages. Below are the most famous of these rules.

Random code

As I already wrote above, in general case For a replacement cipher, you need to figure out which letter should be replaced with which. The simplest thing is to take and randomly mix the letters of the alphabet, and then write them down under the line of the alphabet. The result is a code table. For example, this one:

The number of variants of such tables for 33 letters of the Russian language = 33! ≈ 8.683317618811886*10 36 . From an encryption point of view short messages- this is the most perfect option: To decipher, you need to know the code table. It is impossible to go through such a number of options, but if you encrypt short text, then frequency analysis cannot be applied.

But to use it in quests, such a code table needs to be presented in a more beautiful way. The solver must first either simply find this table or solve some kind of verbal-letter riddle. For example, guess or solve.

Keyword

One option for compiling a code table is to use a keyword. We write down the alphabet, under it we first write down a keyword consisting of non-repeating letters, and then we write down the remaining letters. For example, for the word "manuscript" we get the following table:

As you can see, the beginning of the table was shuffled, but the end remained unshuffled. This is because the most “senior” letter in the word “manuscript” is the letter “U”, so after it there is an unmixed “tail”. The letters in the tail will remain unencoded. You can leave it like this (since most of letters are still encoded), but you can take a word that contains the letters A and Z, then all the letters will be mixed, and there will be no “tail”.

The keyword itself can also be guessed in advance, for example using or. For example, like this:

Having solved the arithmetic rebus frame and matched the letters and numbers of the encrypted word, then you will need to enter the resulting word into the code table instead of the numbers, and enter the remaining letters in order. You will get the following code table:

Atbash

The cipher was originally used for the Hebrew alphabet, hence the name. The word atbash (אתבש) is made up of the letters "alef", "tav", "bet" and "shin", that is, the first, last, second and penultimate letters of the Hebrew alphabet. This sets the replacement rule: the alphabet is written out in order, and underneath it is written out backwards. Thus, the first letter is encoded into the last, the second - into the penultimate, etc.

The phrase “TAKE HIM TO THE EXCEPTION” is transformed with the help of this cipher into “ERCHGTC ЪБР E VФНПжС”. Online Atbash cipher calculator

ROT1

This code is known to many children. The key is simple: each letter is replaced by the next one in the alphabet. So, A is replaced by B, B by C, etc., and I is replaced by A. “ROT1” means “ROTate 1 letter forward through the alphabet"(English: "turn/move the alphabet one letter forward"). The message “Oinklokotam oinklokotamit at night” will become “Tsyalmplpubn tsyalmplpubnyu rp opshbn.” ROT1 is fun to use because it is easy for a child to understand and easy to use for encryption. But it is just as easy to decipher.

Caesar Cipher

The Caesar cipher is one of the oldest ciphers. When encrypting, each letter is replaced by another, spaced from it in the alphabet not by one, but by larger number positions. The cipher is named after the Roman emperor Gaius Julius Caesar, who used it for secret correspondence. He used a three letter shift (ROT3). Many people suggest doing encryption for the Russian alphabet using this shift:

I still believe that the Russian language has 33 letters, so I propose this code table:

It’s interesting that in this version the replacement alphabet reads the phrase “where is the hedgehog?” :)

But the shift can be done by an arbitrary number of letters - from 1 to 33. Therefore, for convenience, you can make a disk consisting of two rings rotating relative to each other on the same axis, and write the letters of the alphabet on the rings in sectors. Then it will be possible to have at hand the key for the Caesar code with any offset. Or you can combine the Caesar cipher with the atbash on such a disk, and you will get something like this:

Actually, that’s why such ciphers are called ROT - from English word“rotate” - “rotate”.

ROT5

In this option, only numbers are encoded, the rest of the text remains unchanged. 5 substitutions are made, therefore ROT5: 0↔5, 1↔6, 2↔7, 3↔8, 4↔9.

ROT13

ROT13 is a variation of the Caesar cipher for Latin alphabet with a shift of 13 characters. It is often used on the Internet in English-language forums as a means of hiding spoilers, main ideas, solutions to riddles, and offensive material from casual view.

The 26-letter Latin alphabet is divided into two parts. The second half is written under the first. When encoding, letters from the top half are replaced by letters from the bottom half and vice versa.

ROT18

It's simple. ROT18 is a combination of ROT5 and ROT13 :)

ROT47

There are more full version this cipher is ROT47. Instead of using the A-Z alphabetical sequence, ROT47 uses a larger set of characters, almost all of the characters displayed are from the first half of the ASCII table. Using this cipher you can easily encode url, e-mail, and it will not be clear that it is exactly url and e-mail :)

For example, a link to this text will be encrypted like this: 9EEAi^^?@K5C]CF^82>6D^BF6DE^4CJAE^4:A96C^K2>6?2nURC@Ecf. Only an experienced solver will be able to guess from the repeated pairs of characters at the beginning of the text that 9EEAi^^ can mean HTTP:⁄⁄ .

Polybius Square

Polybius - Greek historian, general and statesman, who lived in the 3rd century BC. He offered original code a simple replacement, which became known as the “Polybius square” or Polybius chessboard. This type coding was originally used for the Greek alphabet, but was then extended to other languages. The letters of the alphabet fit into a square or suitable rectangle. If there are more letters for a square, then they can be combined in one cell.

Such a table can be used as in the Caesar cipher. To encrypt a square, we find the letter of the text and insert the lower one in the same column into the encryption. If the letter is on the bottom line, then take the top one from the same column. For Cyrillic alphabet you can use the table ROT11(analogue of the Caesar cipher with a shift of 11 characters):

The letters of the first line are encoded into the letters of the second, the second - into the third, and the third - into the first.

But it’s better, of course, to use the “trick” of the Polybius square - the coordinates of the letters:

    Under each letter of the encoded text we write in a column two coordinates (top and side). You will get two lines. Then we write these two lines into one line, divide it into pairs of numbers and using these pairs as coordinates, we again encode using the Polybius square.

    It can be complicated. We write the original coordinates in a line without splitting them into pairs, shift them by odd number of steps, divide the result into pairs and encode again.

Polybius Square can also be created using code word. First, the code word is entered into the table, then the remaining letters. The code word should not contain repeated letters.

A version of the Polybius cipher is used in prisons by tapping out the coordinates of letters - first the line number, then the number of the letter in the line.

Poetic cipher

This encryption method is similar to the Polybius cipher, only the key is not the alphabet, but a poem that fits line by line into a square given size(for example 10x10). If the line is not included, then its “tail” is cut off. Next, the resulting square is used to encode the text letter by letter with two coordinates, as in the Polybius square. For example, take a good verse from “Borodino” by Lermontov and fill out the table. We notice that the letters E, J, X, Ш, Ш, Ъ, E are not in the table, which means we won’t be able to encrypt them. The letters, of course, are rare and may not be needed. But if they are still needed, you will have to choose another verse that contains all the letters.

RUS/LAT

Probably the most common cipher :) If you try to write in Russian, forgetting to switch to the Russian layout, you will end up with something like this: Tckb gsnfnmcz gbcfnm gj-heccrb? pf,sd gthtrk.xbnmcz yf heccre. hfcrkflre? nj gjkexbncz xnj-nj nbgf "njuj^ Why not a code? The best replacement cipher ever. The keyboard acts as a code table.

The conversion table looks like this:

Litorrhea

Litorrhea (from Latin littera - letter) is secret writing, a type of encrypted writing used in ancient Russian handwritten literature. There are two types of litorrhea: simple and wise. A simple one, otherwise called gibberish, is as follows. If “e” and “e” are counted as one letter, then there are thirty-two letters left in the Russian alphabet, which can be written in two rows - sixteen letters in each:

The result will be a Russian analogue of the ROT13 cipher - ROT16:) When encrypting, the upper letter is replaced with a lower one, and the lower letter with an upper one. An even simpler version of litorrhea - leaving only twenty consonant letters:

It turns out a cipher ROT10. When encrypting, only consonants are changed, and vowels and others that are not included in the table are left as is. It turns out something like “dictionary → lsosha”, etc.

Wise litorrhea involves more complex rules substitutions. In various variants that have come down to us, substitutions of entire groups of letters are used, as well as numerical combinations: each consonant letter is assigned a number, and then arithmetic operations over the resulting sequence of numbers.

Bigram encryption

Playfair cipher

The Playfair cipher is a manual symmetric encryption technique that pioneered the use of bigram substitution. Invented in 1854 by Charles Wheatstone. The cipher provides for the encryption of pairs of characters (bigrams), instead of single characters, as in the substitution cipher and more complex systems Vigenere encryption. Thus, the Playfair cipher is more resistant to cracking compared to a simple substitution cipher, since frequency analysis is more difficult.

The Playfair cipher uses a 5x5 table (for the Latin alphabet, for the Russian alphabet you need to increase the table size to 6x6) containing a keyword or phrase. To create a table and use a cipher, just remember the keyword and four simple rules. To create a key table, first of all you need to fill the empty cells of the table with the letters of the keyword (without writing repeating characters), then fill the remaining cells of the table with alphabetical characters not found in the keyword, in order (in English texts usually the "Q" character is omitted to make the alphabet smaller; other versions combine "I" and "J" into one cell). The keyword and subsequent letters of the alphabet can be entered into the table line by line from left to right, boustrophedon or in a spiral from the left top corner to the center. The keyword, supplemented by the alphabet, forms a 5x5 matrix and is the cipher key.

In order to encrypt a message, you need to break it into bigrams (groups of two characters), for example, “Hello World” becomes “HE LL OW OR LD,” and find these bigrams in a table. The two bigram symbols correspond to the corners of a rectangle in the key table. We determine the positions of the corners of this rectangle relative to each other. Then, guided by the following 4 rules, we encrypt pairs of characters source text:

    1) If two bigram symbols match, add an “X” after the first symbol and encrypt new pair characters and continue. Some variants of the Playfair cipher use "Q" instead of "X".

    2) If the bigram symbols of the source text occur in one line, then these symbols are replaced by the symbols located in the nearest columns to the right of the corresponding symbols. If the character is the last in a line, then it is replaced with the first character of the same line.

    3) If the bigram symbols of the source text occur in one column, then they are converted to the symbols of the same column located directly below them. If a character is the bottom character in a column, then it is replaced by the first character of the same column.

    4) If the bigram symbols of the source text are in different columns and different rows, then they are replaced with symbols located in the same rows, but corresponding to other corners of the rectangle.

To decrypt it is necessary to use the inversion of these four rules, discarding the “X” (or “Q”) symbols if they do not make sense in the original message.

Let's look at an example of composing a cipher. We use the “Playfair example” key, then the matrix will take the form:

Let's encrypt the message “Hide the gold in the tree stump”. We break it into pairs, not forgetting about the rule. We get: “HI DE TH EG OL DI NT HE TR EX ES TU MP.” Next we apply the rules:

    1. The bigram HI forms a rectangle, replace it with BM.

    2. The bigram DE is located in one column, replace it with ND.

    3. The bigram TH forms a rectangle, replace it with ZB.

    4. The bigram EG forms a rectangle, replace it with XD.

    5. The bigram OL forms a rectangle, replace it with KY.

    6. The bigram DI forms a rectangle, replace it with BE.

    7. The bigram NT forms a rectangle, replace it with JV.

    8. The bigram HE forms a rectangle, replace it with DM.

    9. Bigram TR forms a rectangle, replace it with UI.

    10. The bigram EX is in one line, replace it with XM.

    11. The bigram ES forms a rectangle, replace it with MN.

    12. The bigram TU is in one line, replace it with UV.

    13. The bigram MP forms a rectangle, replace it with IF.

We get the encrypted text “BM ND ZB XD KY BE JV DM UI XM MN UV IF.” Thus the message "Hide the gold in the tree stump" is converted to "BMNDZBXDKYBEJVDMUIXMMNUVIF".

Double Wheatstone square

Charles Wheatstone developed not only the Playfair cipher, but also another bigram encryption method called the "double square". The cipher uses two tables at once, placed along the same horizontal line, and encryption is done in bigrams, as in the Playfair cipher.

There are two tables with Russian alphabets randomly located in them.

Before encryption, the original message is divided into bigrams. Each bigram is encrypted separately. The first letter of the bigram is found in the left table, and the second letter in the right table. Then mentally construct a rectangle so that the letters of the bigram lie in it opposite vertices. The other two vertices of this rectangle give the letters of the ciphertext bigram. Let us assume that a bigram of the original text IL is encrypted. The letter I is in column 1 and row 2 of the left table. The letter L is in column 5 and row 4 of the right table. This means that the rectangle is formed by rows 2 and 4, and columns 1 of the left table and 5 of the right table. Consequently, the ciphertext bigram includes the letter O, located in column 5 and line 2 of the right table, and the letter B, located in column 1 and line 4 of the left table, i.e. we obtain the ciphertext bigram OB.

If both letters of the message bigram lie in one line, then the letters of the ciphertext are taken from the same line. The first letter of the ciphertext bigram is taken from the left table in the column corresponding to the second letter of the message bigram. The second letter of the ciphertext bigram is taken from the right table in the column corresponding to the first letter of the message bigram. Therefore, the TO message bigram turns into a ZB ciphertext bigram. All message bigrams are encrypted in a similar way:

Message APPLIED AYU _SH ES TO GO

Ciphertext PE OV SHCHN FM ESH RF BZ DC

Double-square encryption produces a highly tamper-resistant and easy-to-use cipher. Cracking a double square ciphertext requires great effort, and the length of the message must be at least thirty lines, and without a computer it’s not possible at all.

Polyalphabetic ciphers

Vigenère cipher

A natural development of the Caesar cipher was the Vigenère cipher. Unlike monoalphabetic ones, this is already a polyalphabetic cipher. The Vigenère cipher consists of a sequence of several Caesar ciphers with different meanings shift For encryption, a table of alphabets called a "tabula recta" or "Vigenère square (table)" can be used. At each stage of encryption, different alphabets are used, selected depending on the letter of the keyword.

For the Latin alphabet, the Vigenère table might look like this:

For the Russian alphabet like this:

It is easy to see that the rows of this table are ROT ciphers with successively increasing shifts.

They encrypt it like this: under the line with the source text, the keyword is cyclically written into the second line until the entire line is filled. Each letter of the source text has its own key letter below. Next in the table we find the encoded letter of the text in the top line, and the letter of the code word on the left. At the intersection of the column with the original letter and the row with the code letter, the desired encrypted letter of the text will be located.

An important effect achieved when using a polyalphabetic cipher such as the Vigenère cipher is masking the frequencies of appearance of certain letters in the text, which simple substitution ciphers do not have. Therefore, it will no longer be possible to apply frequency analysis to such a cipher.

To encrypt with the Vigenère cipher, you can use Vigenère cipher online calculator. For various options Vigenère cipher with a shift to the right or left, as well as replacing letters with numbers, you can use the tables below:

Gronsveld cipher

Book cipher

If you use a whole book (for example, a dictionary) as a key, then you can encrypt not individual letters, but entire words and even phrases. Then the coordinates of the word will be the page number, line number and word number in the line. For each word you get three numbers. You can also use the internal notation of the book - chapters, paragraphs, etc. For example, it is convenient to use the Bible as a code book, because there is a clear division into chapters, and each verse has its own marking, which makes it easy to find the desired line of text. True, not in the Bible modern words type “computer” and “Internet”, so for modern phrases It is better, of course, to use an encyclopedic or explanatory dictionary.

These were substitution ciphers, in which letters are replaced with others. And there are also ones in which the letters are not replaced, but mixed together.

On this day of yours professional holiday notes the Cryptographic Service of Russia.

"Cryptography" from ancient Greek means "secret writing".

How did you hide words before?

A peculiar method of transmitting a secret letter existed during the reign of the dynasty of Egyptian pharaohs:

they chose a slave. They shaved his head bald and painted the text of the message onto it with waterproof vegetable paint. When the hair grew back, it was sent to the recipient.

Cipher- this is some kind of text conversion system with a secret (key) to ensure the secrecy of transmitted information.

AiF.ru made a selection interesting facts from the history of encryption.

All secret writings have systems

1. Acrostic- a meaningful text (word, phrase or sentence), composed of initial letters each line of the poem.

Here, for example, is a riddle poem with the answer in the first letters:

D I am known loosely by my name;
R The rogue and the innocent swear by him,
U I am more than a technician in disasters,
AND Life is sweeter with me and in the best lot.
B well-being pure souls I can serve alone
A between villains - I was not created.
Yuri Neledinsky-Meletsky
Sergei Yesenin, Anna Akhmatova, Valentin Zagoryansky often used acrostics.

2. Litorrhea- a type of encrypted writing used in ancient Russian handwritten literature. It can be simple and wise. A simple one is called gibberish writing, it consists of the following: placing the consonant letters in two rows in the order:

they use upper letters in writing instead of lower ones and vice versa, and the vowels remain unchanged; for example, tokepot = kitten and so on.

Wise litorrhea involves more complex substitution rules.

3. "ROT1"- a code for kids?

You may have used it as a child too. The key to the cipher is very simple: each letter of the alphabet is replaced by the next letter.

A is replaced by B, B is replaced by C, and so on. "ROT1" literally means "rotate forward 1 letter in the alphabet." Phrase "I love borscht" will turn into a secret phrase “Ah myvmya”. This cipher is intended for fun and is easy to understand and decipher even if the key is used in reverse direction.

4. From rearranging terms...

During World War I, confidential messages were sent using so-called permutation fonts. In them, letters are rearranged using some given rules or keys.

For example, words can be written backwards, so that the phrase “Mom washed the frame” turns into a phrase "amam alym umar". Another permutation key is to rearrange each pair of letters so that the previous message becomes “am am y al ar um”.

It may seem that complex permutation rules can make these ciphers very difficult. However, many encrypted messages can be decrypted using anagrams or modern computer algorithms.

5. Caesar's sliding cipher

It consists of 33 different ciphers, one for each letter of the alphabet (the number of ciphers varies depending on the alphabet of the language used). The person had to know which Julius Caesar cipher to use in order to decipher the message. For example, if the cipher E is used, then A becomes E, B becomes F, C becomes Z, and so on alphabetically. If the Y cipher is used, then A becomes Y, B becomes Z, B becomes A, and so on. This algorithm is the basis for many more complex ciphers, but in itself does not provide reliable protection of message secrecy, since checking 33 different encryption keys will take a relatively short time.

Nobody could. Try it

Encrypted public messages tease us with their intrigue. Some of them still remain unsolved. Here they are:

Kryptos. A sculpture created by artist Jim Sanborn that is located in front of the Central Intelligence Agency headquarters in Langley, Virginia. The sculpture contains four encryptions; the code of the fourth has not yet been cracked. In 2010, it was revealed that characters 64-69 NYPVTT in Part 4 meant the word BERLIN.

Now that you have read the article, you will probably be able to solve three simple ciphers.

Leave your options in the comments to this article. The answer will appear at 13:00 on May 13, 2014.

Answer:

1) Saucer

2) The baby elephant is tired of everything

3) Good weather