0Pricing
Reverse Engineering & Binary Analysis Basics · 강의

엔디언과 바이트 순서

여러 바이트로 이루어진 값이 메모리와 파일에 배치되는 방식, 엔디언이 초보자를 혼란스럽게 하는 이유, 원시 바이트를 올바르게 읽는 방법을 이해합니다.

엔디언과 바이트 순서은(는) CoddyKit의 무료 Reverse Engineering & Binary Analysis Basics 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Reverse Engineering & Binary Analysis Basics 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Reverse Engineering & Binary Analysis Basics 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Bytes Have an Order

You learned how data is represented in binaries. But a number like 0x12345678 occupies four bytes, and the CPU must decide which byte comes first in memory.

That decision is called endianness.

Little-Endian

In little-endian, the least significant byte is stored first (lowest address).

The value 0x12345678 is stored as the bytes 78 56 34 12. x86, x64, and most ARM systems use little-endian.

Value:   0x12345678
Memory:  78 56 34 12   (low -> high address)

Big-Endian

In big-endian, the most significant byte is stored first.

The same value 0x12345678 is stored as 12 34 56 78. Network protocols and some older RISC chips use big-endian, so it is also called network byte order.

Value:   0x12345678
Memory:  12 34 56 78   (low -> high address)

Why It Matters in RE

When you see raw bytes in a hex editor, you must apply the correct endianness to recover the real value. Misreading endianness turns a valid pointer into garbage.

  • Reading addresses
  • Parsing file headers
  • Interpreting struct fields

Reading a 4-Byte Integer

Suppose a hex dump shows the bytes 2A 00 00 00. On a little-endian machine that is the integer 42, not 0x2A000000.

Always know the platform before interpreting.

Bytes:  2A 00 00 00
LE int: 0x0000002A = 42
BE int: 0x2A000000 = 704643072

Seeing It in Code

This C snippet inspects the running machine's endianness by aliasing an int through a byte pointer.

#include <stdio.h>
int main(void) {
    unsigned int x = 0x12345678;
    unsigned char *p = (unsigned char *)&x;
    printf('First byte: %02X\n', p[0]);
    return 0;
}

Network Byte Order

Protocols standardize on big-endian so machines of different architectures agree. C provides conversion helpers like htons and ntohl.

When reversing network code, watch for these calls; they reveal which fields are multi-byte.

uint16_t port = htons(8080);  // host -> network order

Byte Swapping

Converting between endian formats means reversing the byte order. Tools and disassemblers often offer a one-click swap, but understanding the mechanism is essential.

uint32_t swap32(uint32_t v) {
    return ((v & 0xFF) << 24) |
           ((v & 0xFF00) << 8) |
           ((v >> 8) & 0xFF00) |
           ((v >> 24) & 0xFF);
}

Endianness in File Formats

Many file formats declare their endianness in a magic field. ELF stores EI_DATA in its header; TIFF starts with II (Intel/little) or MM (Motorola/big).

Reading this field first tells you how to parse the rest.

Common Pitfalls

Beginners often:

  • Read bytes left-to-right and forget to reverse for little-endian
  • Assume the target matches their own machine
  • Mix endianness mid-struct

When a pointer looks absurd, suspect endianness first.

Tools That Show Endianness

Most analysis tools let you toggle interpretation. In a hex editor you can flip between little- and big-endian data inspectors; disassemblers display the architecture's native order automatically.

When carving raw structures, always confirm the tool's current setting matches the target.

xxd -l 4 sample.bin
# 00000000: 2a00 0000   -> LE int = 42

Quick Check

How is the value 0x12345678 stored on a little-endian machine?

Recap

Endianness decides byte order for multi-byte values:

  • Little-endian: least significant byte first (x86/x64)
  • Big-endian: most significant first (network order)
  • Check the format's endianness field before parsing

Mastering this stops the most common 'garbage value' confusion in binary analysis.

자주 묻는 질문

“엔디언과 바이트 순서” 강의는 무료인가요?

네 — “엔디언과 바이트 순서” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Reverse Engineering & Binary Analysis Basics 강의 전체를 잠금 해제할 수 있습니다. Reverse Engineering & Binary Analysis Basics 강의에는 총 4개의 강의가 포함되어 있습니다.

“엔디언과 바이트 순서”에서 뭘 배우나요?

여러 바이트로 이루어진 값이 메모리와 파일에 배치되는 방식, 엔디언이 초보자를 혼란스럽게 하는 이유, 원시 바이트를 올바르게 읽는 방법을 이해합니다. 브라우저에서 직접 실행하는 실습 코드로 Reverse Engineering & Binary Analysis Basics을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Reverse Engineering & Binary Analysis Basics을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Reverse Engineering & Binary Analysis Basics은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“엔디언과 바이트 순서” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Reverse Engineering & Binary Analysis Basics 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Reverse Engineering & Binary Analysis Basics 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. CPU 아키텍처 개요
  2. 바이너리의 데이터 표현
  3. 일반적인 바이너리 파일 형식
  4. 엔디언과 바이트 순서
← Reverse Engineering & Binary Analysis Basics(으)로 돌아가기