Challenges
Single-byte XOR
Cryptography
Easy
XOR basics
Solves: 16
Single-byte XOR
Author: CyberSamSU
Points
12
XOR (exclusive OR) is an operation that compares two bits: if the bits are different, the result is 1; if they are the same, it is 0. In Python, it is written with the ^ symbol, for example 5 ^ 3 = 6.
In cryptography, XOR is very valuable because it is an operation that is its own inverse: (m ^ k) ^ k = m. That is, encryption and decryption consist of one and exactly the same operation — a separate "reverse algorithm" is not needed.
Each byte of the following message is XORed with the key 0x5a (90 in decimal). Restore the message to its original state:
181b0308150b21026a0805386b2805386e232e05386b366e3405386a2932366e
343e6b27
Python: bytes(b ^ 0x5a for b in bytes.fromhex(s)).decode()
Theory: learn the topic
To submit a flag, log in.