Master the fundamental concepts of binary formats through this focused micro-challenge.
A 32-bit value like 0x12345678 occupies four bytes of memory, but in what order? Little-endian machines (x86-64, most ARM configurations) store the least significant byte first: 78 56 34 12. Big-endian stores the most significant first: 12 34 56 78.
Every multi-byte field you will parse in this track (ELF section offsets, PE timestamps, network packet lengths) is stored in a specific byte order. Read it with the wrong assumption and every offset you compute lands in garbage. Network protocols use big-endian ("network byte order"), while x86 file formats are little-endian, so real parsers convert constantly with functions like ntohl and le32toh.
For example, input 12345678 prints as 78 56 34 12 on a little-endian dump. The ELF magic word 464c457f appears in memory as 7f 45 4c 46.
You will take a 32-bit hexadecimal value and print its bytes in little-endian storage order, exactly how a hex dump of x86 memory would show it. This task asks you to extract each byte with shifts and masks, which is the same technique you will use when parsing ELF and PE headers manually.
The standard technique uses bitwise AND and right shifts:
value & 0xff(value >> 8) & 0xff(value >> 16) & 0xff(value >> 24) & 0xffWireshark, Ghidra, and every hex editor on x86 hardware assumes little-endian layout when displaying 32-bit fields. Mixing up byte order is one of the most common mistakes new binary analysts make, which is why this exercise builds the habit early.
Read one 32-bit hexadecimal value from stdin (e.g. "12345678").
Print its four bytes in little-endian order as two-digit lowercase hex separated by spaces, followed by a newline:
Input 12345678 -> Output "78 56 34 12"
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github