Does hexdump respect the endianness of its system?
The traditional BSD hexdump
utility uses the platform's endianness, so the output you see means your machine is little-endian.
Use hexdump -C
(or od -t x1
) to get consistent byte-by-byte output irrespective of the platform's endianness.
From the manpage:
-x Two-byte hexadecimal display. Display the input offset in hexa‐
decimal, followed by eight, space separated, four column, zero-
filled, two-byte quantities of input data, in hexadecimal, per
line.
...
If no format strings are specified, the default display is equivalent to
specifying the -x option.
Your output is little-endian (least significant byte first), which is also the endianness of the x86 and x86_64 architectures, which you are probably using.