I want to generate a list of the hex values of all 256 byte-combinations.
Basically, I want for example 'A' => '\x41'. I've only found modules capable of converting 'A' => '41', and this is not what I want.
How am I to solve this problem? Does anybody know an appropriate module or algorithm (as I'd like to avoid hardcoding 256 hexvalues...)?
ord('A') returns the ASCII value as an integer (65 in the case of 'A'). You can think of an integer in any base you want. hex(ord('A')) gives you a nice string ("0x41" in this case), as does print "%x" % ord('A').
Generate a list of hex bytes in Python