string - Python - Generating all combinations of Hexadecimal values -
i have encryption key 32-bits in hexadecimal format. i'm given 22 bits. have find plaintext. thought process brute-force attack , find other 10 bits. given ciphertext. encryption used aes in 128-bit ecb mode. using python, started learning not expert yet.
my approach take 22-bit key , concatenate other 10 bits, feed aes along ciphertext , decrypt check if 1 of resulting phrases resembles proper sentence. part stuck on generating 10 bit hexadecimal string.
this output want:
0000000000 0000000001 0000000002 ... 000000000f ... ffffffffff
what approach use this? tried making dictionary , assigning numerical values hexadecimal values stuck on how write loop give sequence want output.
def gen_all_hex(): = 0 while < 16**10: yield "{:010x}".format(i) += 1 s in gen_all_hex(): print(s)
result:
0000000000 0000000001 0000000002 0000000003 0000000004 0000000005 0000000006 0000000007 0000000008 0000000009 000000000a 000000000b 000000000c 000000000d 000000000e 000000000f 0000000010 0000000011 0000000012 0000000013 0000000014 0000000015 0000000016 0000000017 0000000018 0000000019 000000001a ...
note it's going take long time iterate through 1,099,511,627,776 values.
Comments
Post a Comment