I have a binaryfile.bin where I have a set of instructions which I have to decode to hexadecimal. I written a program in java that does this and I get the same hexadecimal as i get from Hexdump in linux.
I know what the actual Binary should be for each of the instructions in the binary file, as this is given. Which can be seen below. I can see that there is some relation between the two hexes.
Hexdump Binary Hex of Binary
1303d007 00000111110100000000001100010011 7D00313
93033302 00000010001100110000001110010011 2330393
138ec3f9 11111001110000111000111000010011 F9C38E13
1305a000 00000000101000000000010100010011 A00513
73000000 00000000000000000000000001110011 73
My question is how do I get from "hexdump" to "Hex of Binary" or How would one go about this as I am only provided with a binary file ?
I dont hope my question is too unclear ?
Its all about endianness.
Every byte is represented by two Hex characters (each Hex is 4 bits).
Your hexdump, 1303d007
is the four bytes 13
03
d0
07
.
Your hex-to-binary, 7D00313
is the same four bytes, but formatted differently and in different order. It is 07
D0
03
13
. The preceding '0' on the 07
was truncated for simplicity, but then you'll notice that the order is 100% reversed.
Endianness tells you the order that bytes appear along some form of transmission or storage. It answers the question, "Is the most significant byte going to appear first or last?".