Share on Facebook Share on Twitter Email
Answers.com

Hex dump

 
Wikipedia: Hex dump
A hex dump of the 318 byte Wikipedia favicon.

Hex dump is a hexadecimal view (on screen or a printout) of computer data, from RAM or from a file or storage device. Each byte (8-bits) is represented as a two-digit hexadecimal number. Hex dumps are commonly organized into rows of 8 or 16 bytes, sometimes separated by whitespaces. Some hex dumps have the hexadecimal memory address at the beginning and checksum byte at the end of each line.

Although the name implies the use of base-16 output, options may be available for base-8 (octal) or base-10 (decimal) output. Some common names for this program function are hexdump and od.

Contents

Samples

A sample partial hex dump of a program:

 00105e0 e6b0 343b 9c74 0804 e7bc 0804 e7d5 0804
 00105f0 e7e4 0804 e6b0 0804 e7f0 0804 e7ff 0804
 0010600 e80b 0804 e81a 0804 e6b0 0804 e6b0 0804

The above example, however, represents an ambiguous form of hex dump, as the byte order may be uncertain. Such hex dumps are good only in the context of a well-known byte order standard or when values are intentionally given in their full form (and may result in variable number of bytes), such as:

 00105e0 e6 b008 04e79e08 04e7bc 08 04 e7 d50804

When explicit byte sequence is required (for example for hex dump of machine code programs or ROM content) a byte-by-byte representation is favoured, commonly organized in 16-byte rows with an optional divider between 8-byte groups:

 00105e0 e6 b0 08 04 e7 9e 08 04 - e7 bc 08 04 e7 d5 08 04
 00105f0 e7 e4 08 04 e6 b0 08 04 - e7 f0 08 04 e7 ff 08 04
 0010600 e8 0b 08 04 e8 1a 08 04 - e6 b0 08 04 e6 b0 08 04

Sometimes a condensed form is also used, without whitespaces between values:

 00105e0 e6b00804e79e0804e7bc0804e7d50804
 00105f0 e7e40804e6b00804e7f00804e7ff0804
 0010600 e80b0804e81a0804e6b00804e6b00804

A standard default display of those same bytes as two-byte words on a modern x86 (little-endian) computer would usually look like this:

 00105e0 b0e6 0408 9ee7 0408 bce7 0408 d5e7 0408
 00105f0 e4e7 0408 b0e6 0408 f0e7 0408 ffe7 0408
 0010600 0be8 0408 1ae8 0408 b0e6 0408 b0e6 0408

Often an additional column show the corresponding ASCII text translation:

0000: FF D8 FF E0 00 10 4A 46 49 46 00 01 02 01 00 48  ......JFIF.....H
0010: 00 48 00 00 FF ED 0A 96 50 68 6F 74 6F 73 68 6F  .H......Photosho
0020: 70 20 33 2E 30 00 38 42 49 4D 04 04 07 43 61 70  p 3.0.8BIM...Cap

When hex dumps are intended to be manually entered into a computer, such as was the case with print magazine articles of home computer era a checksum byte (or two) would be added at the end of each row, commonly calculated as simple 256 modulo of sum of all values in the row or a more sophisticated CRC. This checksum would be used to determine whether users entered the row correctly or not.

Compression of duplicate lines

Normally, all lines of display output that contain the same data as the previous line are not shown; instead, a line containing just one asterisk is displayed. For example, a block of all zeros is printed as:

 0000000 0000 0000 0000 0000 0000 0000 0000 0000
 *
 0000030

This compression feature makes a useful tool for inspecting large files or complete devices for irregularities. In a modern Linux system, it is convenient to scan an entire hard drive to check if it is all blank:

 # hexdump /dev/sda (replace sda with the proper name for the device to be scanned)

The -v option causes hexdump to display all input data, explicitly:

 0000000 0000 0000 0000 0000 0000 0000 0000 0000
 0000010 0000 0000 0000 0000 0000 0000 0000 0000
 0000020 0000 0000 0000 0000 0000 0000 0000 0000

od and hexdump

"The utilities od and hexdump output octal, hex, or otherwise encoded bytes from a file or stream... Depending on your system type, either or both of these two utilities will be available--BSD systems deprecate od for hexdump , GNU systems the reverse. The two utilities, however, have exactly the same purpose, just slightly different switches."[1]

See also

External links


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 
Learn More
examining the entrails (computer jargon)
Pelles C
Executable

What is 255.255.255.0 in hex? Read answer...
How do you hex someone? Read answer...
What is a hex-keypad? Read answer...

Help us answer these
What does hex stands for?
How do you hex petz?
Words that have hex in them?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Hex dump" Read more