I have an Encryption key which is 32-bits in Hexadecimal format. But I'm only given 22 bits. I have to find the Plaintext. My thought process is to do a brute-force attack and find the other 10 bits. I am also given the Ciphertext. The Encryption used is AES in 128-bit ECB Mode. I am using Python, but I just started learning it so I am not an expert yet.
My approach is to take the 22-bit key and concatenate the other 10 bits, feed that into AES along with the Ciphertext and Decrypt to check if one of the resulting phrases resembles a proper sentence. The only part that I am stuck on is generating the 10 bit Hexadecimal string.
This is the output that I want:
0000000000
0000000001
0000000002
...
000000000F
...
FFFFFFFFFF
What is an approach I could use to do this? I tried making a dictionary and assigning numerical values to all Hexadecimal values but I am stuck on how to write a loop that could give the sequence I want as an output.