Why is 44100 in hex in reversed order in hex editor?
Asked Answered
S

4

7

I opened a wave file through hex editor. I tried two hex editors, and both put 44100 in hex (AC44) in reversed order.

Why is that? For ASCII characters, "fmt", the ordering is natural.

enter image description here

This is AC44.

enter image description here

Does this have to do with Big-Endian / Little-Endian? But why would other values displayed in the correct order?

Thanks!

Stringy answered 1/11, 2011 at 20:44 Comment(0)
M
6

Yes, it is stored in little endian format. The endianness of each field is shown here:

WAV format

Note that there is a mixture of big and little endian.

Mesencephalon answered 1/11, 2011 at 20:47 Comment(1)
For more info on FOURCC tags ("WAVE", "fmt "), see msdn.microsoft.com/en-us/library/windows/desktop/…Lowbred
L
2

It does have to do with endian-ness. The data type you're writing to is an integer which gets stored as a multiple byte chunk.

The reason the text atoms look like they aren't reversed is because they are an ordered list of single byte characters.

Lowbred answered 1/11, 2011 at 20:50 Comment(0)
T
1

Actually it depends on the architecture and/or file format, see e.g. here. You can find both cases, one where the high byte comes first and also where the low byte comes first. In your case it is the first (called litte endian).

Towle answered 1/11, 2011 at 20:47 Comment(0)
M
1

Because your hex editor is printing out hex bytes from low address to high address, and little-endian (such x86/ia32) machines store the low digits of multi-byte entities in the lower address.

You could print out memory from the high addresses to the low addresses (but still left to right) if you want to see bytes in the opposite order, since numbers are usually printed out that way in English speaking countries.

Mountford answered 2/11, 2011 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.