Search code examples
linuxreverse-engineeringhexdump

Hexdump reverse command


The hexdump command converts any file to hex values.

But what if I have hex values and I want to reverse the process, is this possible?


Solution

  • There is a similar tool called xxd. If you run xxd with just a file name it dumps the data in a fairly standard hex dump format:

    # xxd bdata
    0000000: 0001 0203 0405
    ......
    

    Now if you pipe the output back to xxd with the -r option and redirect that to a new file, you can convert the hex dump back to binary:

    # xxd bdata | xxd -r >bdata2
    # cmp bdata bdata2
    # xxd bdata2
    0000000: 0001 0203 0405