什么是十六进制转储 - 这是什么意思?
thegladiator:~/cp$ cat new.txt
Hello World This is a Trest Progyy
thegladiator:~/cp$ hexdump new.txt
0000000 6548 6c6c 206f 6f57 6c72 2064 6854 7369
0000010 6920 2073 2061 7254 7365 2074 7250 676f
0000020 7979 000a
0000023
文本数据是如何以十六进制表示的?这有什么意义呢?
thegladiator:~/cp$ cat new.txt
Hello World This is a Trest Progyy
thegladiator:~/cp$ hexdump new.txt
0000000 6548 6c6c 206f 6f57 6c72 2064 6854 7369
0000010 6920 2073 2061 7254 7365 2074 7250 676f
0000020 7979 000a
0000023
How is that text data represented in hex like that? What is the meaning of this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如它所说,以十六进制格式转储数据:
奇怪的是,所有字节都被交换了 (65 48 : e H)
如果你在 *nix 系统上,你可以使用 'od -x ',或者'man od'会告诉你从od获取数据的所有方法:)
it's just what it says, a dump of the data in hexidecimal format:
It is odd though that all of the bytes are swapped (65 48 : e H)
If you're on a *nix system, you can use 'od -x', or 'man od' will tell you all the ways to get data from od :)
文件
new.txt
中的文本使用 ASCII 编码存储。每个字母由一个数字表示,十进制:32-127 十六进制:20-7F。因此,前三个字母 (H,e,l
) 由十进制数字:72,101,108
和十六进制数字:48,65,6C
表示code>Hexdump
默认情况下采用输入文件new.txt
的每个 16 位字,并将该字输出为十六进制数。因为它是在 16 位而不是 8 位上运行,所以您会看到输出的顺序是意外的。如果您改用
xxd new.txt
,您将看到按预期顺序的输出。The text in the file
new.txt
is stored using ASCII encoding. Each letter is represented by a number, decimal: 32-127 hexidecimal: 20-7F. So the first three letters (H,e,l
), are represented by the decimal numbers:72,101,108
and the hexidecimal numbers:48,65,6C
Hexdump
by default takes each 16 bit word of the input filenew.txt
and outputs this word as a Hexidecimal number. Because it is operating on 16 bits, not 8 bits, you see the output in an unexpected order.If you instead use
xxd new.txt
, you will see the output in the expected order.