How to create a hexdump and convert back?

The format of hexdump makes its possible to convert any types of files into plain text, which would simply your file transfer in some cases. How can we make a hexdump from a given file? Well, with the help of a common tool ‘xxd‘, it’s quite easy.

xxd is part of vim-common in Linux distributions, and available in Mac OS X as well,

$ rpm -qf /usr/bin/xxd

To convert a file to hexdump,

$xxd -p /etc/passwd

To convert hexdump to its original format,

$ xxd -r -p file.hex.dump

This command will not bring any additional chars,

joseph$ cat /etc/passwd | md5
joseph$ xxd -p /etc/passwd | xxd -r -p | md5

Other tools you can refer to are hexdump, od, etc.

Leave a comment

Your email address will not be published. Required fields are marked *