Hex dump

From Wikipedia, the free encyclopedia
 
 

 

A hex dump of the 318 byte Wikipedia favicon

In computing, a hex dump is a hexadecimal view (on screen or paper) of computer data, from RAM or from a file or storage device. Looking at a hex dump of data is commonly done as a part of debugging, or of reverse engineering.

In a hex dump, 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/or a checksum byte at the end of each line.

Although the name implies the use of base-16 output, some hex dumping software may have options for base-8 (octal) or base-10 (decimal) output. Some common names for this program function are hexdumpodxxd and simply dump or even D.

Samples[edit]

A sample partial hex dump of a program, as produced by the Unix program hexdump:

 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

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

 00105e0 e6b00804e79e0804e7bc0804e7d50804
00105f0 e7e40804e6b00804e7f00804e7ff0804
0010600 e80b0804e81a0804e6b00804e6b00804

A Unix 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 shows the corresponding ASCII text translation (e.g. hexdump -C or hd):

0000: 57 69 6B 69 70 65 64 69 61 2C 20 74 68 65 20 66  Wikipedia, the f
0010: 72 65 65 20 65 6E 63 79 63 6C 6F 70 65 64 69 61 ree encyclopedia
0020: 20 74 68 61 74 20 61 6E 79 6F 6E 65 20 63 61 6E that anyone can
0030: 20 65 64 69 74 00 00 00 00 00 00 00 00 00 00 00 edit...........

Checksum[edit]

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.

A variety of hex dump file formats -- including S-recordIntel HEX, and Tektronix extended HEX -- have a similar checksum value at the end of each row. 187259

Compression of duplicate lines[edit]

In the Unix programs od and hexdump, not all lines of display output that contain the same data as the previous line are 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 and od 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[edit]

On Unix/POSIX/GNU systems: "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]

DUMP, DDT and DEBUG[edit]

In the CP/M 8 bit operating system used on early personal computers, the standard DUMP program would list a file 16 bytes per line with the hex offset at the start of the line and the ASCII equivalent of each byte at the end.[2] Bytes outside the standard range of printable ASCII characters (20 to 7E) would be displayed as a single period for visual alignment. This same format was used to display memory when invoking the D command in the standard CP/M debugger DDT.[3] Later incarnations of the format (e.g. in the DOS debugger DEBUG) changed the space between the 8th and 9th byte to a dash without changing the overall width.

This notation has been retained in operating systems that were directly or indirectly derived from CP/M, including DR-DOSMS-DOSOS/2 and MS-Windows. On Linux systems, the command hexcat produces this classic output format too. The main reason for the design of this format is that it fits the maximum amount of data on a standard 80 character wide screen or printer, while still being very easy to read and skim visually.

1234:0000: 57 69 6B 69 70 65 64 69 61 2C 20 74 68 65 20 66  Wikipedia, the f
1234:0010: 72 65 65 20 65 6E 63 79 63 6C 6F 70 65 64 69 61 ree encyclopedia
1234:0020: 20 74 68 61 74 20 61 6E 79 6F 6E 65 20 63 61 6E that anyone can
1234:0030: 20 65 64 69 74 00 00 00 00 00 00 00 00 00 00 00 edit...........

References[edit]

External links[edit]

Hex dump的更多相关文章

  1. Hex Dump In Many Programming Languages

    Hex Dump In Many Programming Languages See also: ArraySumInManyProgrammingLanguages, CounterInManyPr ...

  2. ORACLE 数据块dump

    1. rdba(Tablespace relative database block address) 是相对数据块地址,是数据所在的地址,rdba可就是rowid 中rfile#+block#. 根 ...

  3. dump buffer cache

    1.基础内容: ALTER SESSION SET EVENTS 'immediate trace name buffers level n'; n取值意义: 1 只转储buffer header. ...

  4. 定位表的数据块并且dump出来

    SQL> select * from city;         ID NAME ---------- ----------          7 Chicago          6 Jers ...

  5. dump datafile block

    Oracle dump datafile block有两种方式: 然后根据block id执行dump 命令: SQL> alter system dump datafile 4 block 2 ...

  6. 查看dump oracle数据块查看

    alter system dump datafile 8 block 2523; Block dump from disk:buffer tsn: 87 rdba: 0x160dd924 (88/90 ...

  7. text2pcap: 将hex转储文本转换为Wireshark可打开的pcap文件

    简介 Text2pcap是一个读取ASCII hex转储的程序,它将描述的数据写入pcap或pcapng文件.text2pcap可以读取包含多个数据包的hexdumps,并构建多个数据包的捕获文件.t ...

  8. oracle--dump 块与块分析 (dump 深入实践二)

    一,建立测试环境 01,一个oracle数据库环境 02,具体数据库实验环境配置 SQL> create user test1 identified by kingle; User create ...

  9. ORA-00600 3020 ORA-10567案例

    PlateSpin克隆复制出的Oracle数据库服务器,往往启动数据库实例都会遇到一些杂七杂八的问题.今天测试DR环境时又遇到了一个特殊场景,在此之前,我已经遇到了下面两起案例: ORA-00600: ...

随机推荐

  1. text-shadow

    text-shadow,文字阴影,通过text-shadow不使用ps可以实现文字阴影特效,可以让页面变得更加美观. text-shadow语法 text-shadow : none | <le ...

  2. spring FieldRetrievingFactoryBean

    Spring : 基于XML Schema的配置(一): http://www.tuicool.com/articles/mMjY3uI http://www.cnblogs.com/jifeng/a ...

  3. docker从零开始(二)容器初体验

    使用定义容器 Dockerfile Dockerfile定义容器内所需要的环境.对网络接口和磁盘驱动器等资源的访问在此环境中进行虚拟化,该环境与系统的其他部分隔离,因此您需要将端口映射到外部世界,并具 ...

  4. ORM-班级信息系统

    ORM版学员管理系统 班级表 表结构 class Class(models.Model): id = models.AutoField(primary_key=True) # 主键 cname = m ...

  5. python带cookie提交表单自动登录

    import urllib import urllib2 import cookielib login_url = "xxxxxxxxxxxxx" cj = cookielib.C ...

  6. Python3中的新特性(2)——常见陷阱

    1.文本与字节 Python3对文本字符串(字符)和二进制数据(字节)进行了严格区分,'hello'表示一个以Unicode编码保存的文本字符串,而b'hello'表示一个字节字符串. 在Python ...

  7. F - 等式(1/x + 1/y = 1/n)

    链接:https://www.nowcoder.com/acm/contest/90/F来源:牛客网 题目描述 给定n,求1/x + 1/y = 1/n (x<=y)的解数.(x.y.n均为正整 ...

  8. [xunsearch] 在thinkphp中使用xunsearch

    file: XunSearchController.class.php <?php namespace Home\Controller; include '/opt/xunsearch/sdk/ ...

  9. 浅谈Uber与滴滴快的提供差异化服务带来的商业模式思考

    一.引言 滴滴和快的烧钱的时代已经过去,在那个时代我们消费者着实得到了不少实惠.自从他们温柔的在一起之后,这种实惠就木有了.让我不禁感叹坐车的几率有降低了50%.前段时间,Uber悄无声息的进入我的视 ...

  10. Intellij IDEA错误识别.xml文件

    转自原文Intellij IDEA错误识别文件 今天上午弄了一个多小时,对idea感到十分的沮丧,真是太不好用了,一点儿都不智能,而且有些地方,还被自动的配置错误,导致操作起来就像是脱缰的野马. 言归 ...