What is deterministic serialization in Protocol Buffers and why can't you rely on byte-for-byte stability across languages?

Last updated 8 July 2026

  • Deterministic serialization gives stable bytes for the same message within one runtime and library version (e.g. map entries sorted by key), but it is not a canonical cross-language form.

  • Bytes differ across languages and versions because field order, unknown-field placement, packed vs unpacked repeated encoding, and default-value omission can vary.

  • Never hash or sign serialized bytes expecting another stack to reproduce them. Compare parsed messages, or define your own canonical representation for digests.

All gRPC interview questions