So go ahead and make that happen. You'll need to use this code for the rest of the exercises.
Cryptopals Rule
Always operate on raw bytes, never on encoded strings. Only use hex and base64 for pretty-printing.
Explanation
When we work in cryptography, what really matters are the bytes, not their text representation.
In cryptography, data is not text; it consists of sequences of bytes. Encodings like hex or base64 exist only to make data readable for humans, but they do not affect the actual content.
If we work with strings, we might encounter errors due to different encodings that alter the bytes, for example.
We need to think of data as bytes, not text.
Resolution
First, we are going to create a file named task1.py
Understanding the code
Two libraries are imported
binasciito manipulate hexadecimal data
base64for base64 encoding and decoding functions
After that, three variables are created
hex_string , which contains the hex string provided by Cryptopals
bytes_data , which converts the hex string to bytes using unhexlify