# Task 7. Principles of Encryption and Decryption

Problem statement. Karim has applied to the Spring School of the University for Information Security and needs to solve a test task: decrypt a short phrase. For this, he is provided with an example of the encryption of the word "гипертекст" (hypertext):

## гипертекст $\rightarrow$ игептркетс $\rightarrow$ кезсфтмзфу $\rightarrow$ уфзмтфсзек

Test phrase: врпвл терпраиэ вйзгцфпз

Note. The character "ё" is not used
To solve the problem, we first need to decipher the encryption algorithm. Let's look at the provided example:

- hypertext - the original word.
- igeptrkets - then there is a swap of adjacent characters.
- kezsftmzfu - a shift to the right by 2 characters in the alphabet.
- ufzmtfszek - the word is reversed.

To decrypt, we need to perform all steps in reverse order:

- vrpvl terprai vizgcfpz

Reverse it:

- zpfcgzjv eiarprte lvprv

Shift by 2 characters to the left:

- entfbeza yjyonogr yanoa

Perform the swap of adjacent characters:

- neftebazy yuzhnogo rayona

Note. When performing the task, participants in the olympiad often overlooked the space character, although in a fairly large number of incorrect cases, the desired phrase was clearly visible, and one could have noticed the error in the solution process.