Whats Hex Dump - What does it mean?

后端 未结 2 1270
旧时难觅i
旧时难觅i 2021-02-10 02:13
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 2         


        
2条回答
  •  [愿得一人]
    2021-02-10 02:30

    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.

提交回复
热议问题