See my following example:
werner@X10DAi:~$ echo -n -e "\x12\x34\x56\x78" | od -An -x --endian=big
1234 5678
werner@X10DAi:~$ echo -n -e "\x12\x34\x56\x78" | od -An -x --endian=little
3412 7856
Could you tell me why the latter doesn't give the following result?
7856 3412,
aka,
0x78 0x56 0x34 0x12
Regards,
Zhao
On 22.08.2023 15:58, hongy...@gmail.com wrote:
See my following example:
werner@X10DAi:~$ echo -n -e "\x12\x34\x56\x78" | od -An -x --endian=big 1234 5678(My 'od' doesn't support '--endian'; I use different options below
werner@X10DAi:~$ echo -n -e "\x12\x34\x56\x78" | od -An -x --endian=little 3412 7856
and show only the little-endian results.)
Could you tell me why the latter doesn't give the following result?Endian-ness swaps bytes in "words" (default "word" is 2 octets; you
define what a "word" is).
$ echo -n -e $'\x12\x34\x56\x78' | od -An -t x1
12 34 56 78
$ echo -n -e $'\x12\x34\x56\x78' | od -An -t x2
3412 7856
$ echo -n -e $'\x12\x34\x56\x78' | od -An -t x4
78563412
$ echo -n -e $'\x12\x34\x56\x78\x90\xab' | od -An -t x8
0000ab9078563412
Janis
7856 3412,
aka,
0x78 0x56 0x34 0x12
Regards,
Zhao
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 307 |
Nodes: | 16 (2 / 14) |
Uptime: | 104:08:19 |
Calls: | 6,851 |
Calls today: | 2 |
Files: | 12,355 |
Messages: | 5,415,556 |