Hex
Hexadecimal — Decoding encrypted text
When we encrypt data, the resulting encrypted text (ciphertext) usually consists of non-printable bytes from the ASCII table. To share or store such data across different systems, it is common practice to convert it into a readable format.
In such cases, the base-16 numeral system (hexadecimal) is useful. Each character is converted to its number according to the ASCII table, and then that number is converted from decimal to hexadecimal. The resulting numbers are written sequentially to form one long hex string.
Below, the flag (secret text) is given in hexadecimal form. To restore it to its original form, you need to convert the hex string into bytes.
Given hex string:
666c61677b4865785f736174726c61725f726171616d5f76615f686172666c617264616e5f69626f7261745f31366c696b5f6b6f646c6173687d
In Python, this process can be done using the
bytes.fromhex() function,
and conversely, to convert a byte string to hex format, you can use the
.hex() method.