Hex dump: Difference between revisions
Content deleted Content added
m Pygments can do hexdump |
|||
Line 13: | Line 13: | ||
For example, the string "Rosetta Code is a programming chrestomathy site 😀." encoded in [[wp:UTF-16|UTF-16]] (little-endian - the first two bytes are the [[wp:Byte_order_mark|byte order mark]]), displayed in the canonical format is: |
For example, the string "Rosetta Code is a programming chrestomathy site 😀." encoded in [[wp:UTF-16|UTF-16]] (little-endian - the first two bytes are the [[wp:Byte_order_mark|byte order mark]]), displayed in the canonical format is: |
||
<syntaxhighlight lang="hexdump"> |
|||
<pre> |
|||
00000000 ff fe 52 00 6f 00 73 00 65 00 74 00 74 00 61 00 |..R.o.s.e.t.t.a.| |
00000000 ff fe 52 00 6f 00 73 00 65 00 74 00 74 00 61 00 |..R.o.s.e.t.t.a.| |
||
00000010 20 00 43 00 6f 00 64 00 65 00 20 00 69 00 73 00 | .C.o.d.e. .i.s.| |
00000010 20 00 43 00 6f 00 64 00 65 00 20 00 69 00 73 00 | .C.o.d.e. .i.s.| |
||
Line 22: | Line 22: | ||
00000060 20 00 3d d8 00 de 2e 00 | .=.....| |
00000060 20 00 3d d8 00 de 2e 00 | .=.....| |
||
00000068 |
00000068 |
||
</syntaxhighlight> |
|||
</pre> |
|||
;Task |
;Task |
||
Line 40: | Line 40: | ||
Implement a binary mode. For this task, in binary mode, the example above should be displayed like this: |
Implement a binary mode. For this task, in binary mode, the example above should be displayed like this: |
||
<syntaxhighlight lang="hexdump"> |
|||
<pre> |
|||
00000000 11111111 11111110 01010010 00000000 01101111 00000000 |..R.o.| |
00000000 11111111 11111110 01010010 00000000 01101111 00000000 |..R.o.| |
||
00000006 01110011 00000000 01100101 00000000 01110100 00000000 |s.e.t.| |
00000006 01110011 00000000 01100101 00000000 01110100 00000000 |s.e.t.| |
||
Line 60: | Line 60: | ||
00000066 00101110 00000000 |..| |
00000066 00101110 00000000 |..| |
||
00000068 |
00000068 |
||
</syntaxhighlight> |
|||
</pre> |
|||
Other hexdump/xxd features and a command line interface to your program are optional. |
Other hexdump/xxd features and a command line interface to your program are optional. |