Protobuf 뷰어
Protocol Buffers 바이너리 디코딩
Wire 유형 참조
참고사항
- • 스키마 없이 raw 디코딩 수행
- • 필드 이름은 스키마 없이 알 수 없음
- • 중첩 메시지는 bytes로 표시
- • ZigZag 인코딩된 signed 값 자동 표시
Protocol Buffers Guide
What is Protocol Buffers?
Protocol Buffers (protobuf) is Google's language-neutral, platform-neutral extensible mechanism for serializing structured data. It's smaller, faster, and simpler than XML or JSON, commonly used with gRPC.
Wire Format
Protobuf uses a compact binary format. Each field is encoded as a tag (field number + wire type) followed by the value.
Tag = (field_number << 3) | wire_type
Example: Field 1, string type = (1 << 3) | 2 = 0x0A
Encoding Examples
Varint (int32, int64, bool)
150 → 96 01 (0x9601)Each byte uses 7 bits for data, MSB indicates continuation
String
"Hello" → 0A 05 48 65 6C 6C 6FTag (0A) + Length (05) + UTF-8 bytes
Signed Integer (ZigZag)
-1 → 01, -2 → 03, 1 → 02, 2 → 04ZigZag encoding: (n << 1) ^ (n >> 31)
Getting Protobuf Data
# Capture gRPC traffic with grpcurl
grpcurl -plaintext -d '{"id": 1}' localhost:50051 myservice.MyMethod
# Encode with protoc
echo 'name: "test"' | protoc --encode=MyMessage message.proto | xxd -p
# Decode with protoc
cat data.bin | protoc --decode_raw
Related Tools
관련 도구
Data Format 전체 보기함께 쓰면 좋은 도구를 확인하세요.