什么是十六进制转储 - 这是什么意思?

发布于 2024-10-31 00:11:48 字数 310 浏览 6 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮色兮凉城 2024-11-07 00:11:48

正如它所说,以十六进制格式转储数据:

H 48 
e 65
l 6c
l 6c
o 6f

奇怪的是,所有字节都被交换了 (65 48 : e H)

如果你在 *nix 系统上,你可以使用 'od -x ',或者'man od'会告诉你从od获取数据的所有方法:)

it's just what it says, a dump of the data in hexidecimal format:

H 48 
e 65
l 6c
l 6c
o 6f

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 :)

云归处 2024-11-07 00:11:48

文件 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 file new.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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文