Lecture
Strangely enough, but the simplest and one of the most effective (if used correctly) encryption algorithms is the so-called XOR encryption. Let's try to consider the idea of this simplest method.
As is known from Boolean algebra, the logical addition operation “?” Modulo 2 (or logical exclusive OR - XOR, eXclusive OR) has the following semantics:
That is, the operation z = x? y is essentially bitwise (bitwise - the result does not depend on adjacent bits). If only one of the corresponding bits is 1, then the result is 1. And if both are 0 or both are 1, then the result is 0. If you look closely at the result of applying XOR to two binary numbers, you can see that we can reconstruct one of the terms with second: x = z? y or y = z? x.
From this we can draw the following conclusions: knowing the number y and applying XOR to x, we get z. Then, again, using y, we get the number x back from z. Thus, we can convert a sequence of numbers (x) i into a sequence (z) i. Now we can call the number y the encoding (or encrypting) key. If a person does not know the key, then he will not be able to restore the original sequence of numbers (x) i. But if (x) i is a byte representation of the letters of the text, then an experienced user will be able to open the encrypted text. Since each letter will be represented in the ciphertext with the same z code, using the frequency dictionary, the hacker will be able to calculate the encryption key y if he has a sufficiently long ciphertext in the array.
Comments
To leave a comment
Cryptographic ciphers
Terms: Cryptographic ciphers