# encryption – Decrypt info from bytes

## Question:

I have 100 bytes. Here they are:

``````65 5A 44 5B 58 44 43 8A 4B 5A 4A 5B 41 4F 58 8A 42 4D 8A 40 4A 46 47 55 84
8A 68 8A 47 4F 45 5A 42 58 55 4D 4A 58 4F 41 56 47 51 5F 8A 40 8A 46 44 4E
4F 8A 45 44 5B 4F 41 4F 47 42 55 5F 8A 46 44 4C 4F 58 8A 5B 41 59 4C 42 58
56 8A 48 8A 40 4A 5D 4F 5B 58 48 4F 8A 59 40 5A 4A 52 4F 47 42 55 84 A7 A0
``````

Now you have them. Some meaningful text is written in them. Presumably Russian (pulled out of the game). As I understand it, the bytes are inverted. What kind of encoding is it that is written there and, hell, who is the hero that can explain how to convert them correctly in this case?

Stone bracelet. In settlements unassuming to fashion, it can be used as a decoration.

You were absolutely right, the text is clearly from the game 🙂

Elementary cipher. Each byte of the windows encoded string (1251) is `XOR` with `0xAA` .

It was not difficult to guess, by the frequency of symbols we determined that 8A is most common, we assumed that it was a space. Then I noticed that this is practically the only byte that is greater than 0x80, the rest of the bytes are much smaller. And as you know, the space has the smallest code 0x20, Latin characters begin with 0x41, and Russians do so in the second half of the table, after 0x80. It turns out that all large numbers have turned into small ones, and a small number, on the contrary, into a large one – this is a clear sign of the XOR operation, especially since it is usually used in cryptography since easily reversible by repetition of the operation. `0x8A xor 0x20 = 0xAA` – this is our key. Made a little program that read your hexadecimal character codes, made numbers out of them, and ran `xor 0xAA` . The text is in front of us.

In `perl` my program looked like this:

``````#!/usr/bin/perl
\$a=<>; // Читаем строку из входного файла
@b=split(/ /,\$a); // Делаем массив hex кодов, они через проблел
foreach \$a (@b) // бежим по массиву
{
\$n=hex(\$a) ^ 0xAA;  // Делаем нормальное число из шестнадцетиричного и XOR 0xAA
print(chr(\$n)); // Печатаем символ с этим кодом
}
``````
Scroll to Top