Protobuf Decoder Explainer

Paste a binary Google Protocol Buffers byte array into the input box, and this page will explain the structure of the byte array.

The format of the byte array should be backslash-escaped octal characters, which is the format produced by the ToOctString function in the Protocol Buffers conformance test.

Example Input

Here’s an example of Protocol Buffers conformance test output. Any of the escaped octal byte strings from this output can be pasted into the input box for explanation.

CONFORMANCE TEST BEGIN ====================================

ERROR, test=Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput: Output was not equivalent to reference message: deleted: oneof_nested_message.corecursive.optional_int32: 1
deleted: oneof_nested_message.corecursive.unpacked_int32[1]: 1
. request=protobuf_payload: "\202\007\t\022\007\010\001\020\001\310\005\001\202\007\007\022\005\020\001\310\005\001" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3" test_category: BINARY_TEST, response=protobuf_payload: "\202\007\007\022\005\020\001\310\005\001"
ERROR, test=Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput: Output was not equivalent to reference message: Expect: \202\007\014\022\012\010\001\020\001\310\005\001\310\005\001, but got: \202\007\007\022\005\020\001\310\005\001. request=protobuf_payload: "\202\007\t\022\007\010\001\020\001\310\005\001\202\007\007\022\005\020\001\310\005\001" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3" test_category: BINARY_TEST, response=protobuf_payload: "\202\007\007\022\005\020\001\310\005\001"

Here's a longer example protobuf.

\012\036\032\013\155\156\151\163\164\137\164\162\141\151\156\022\017\060\060\060\060\060\060\055\156\165\155\065\056\160\156\147\022\243\003\062\240\003\012\107\052\105\012\017\012\015\012\011\142\007\012\005\012\003\034\034\001\022\000\022\060\052\056\012\023\012\021\012\015\302\001\012\012\010\032\006\012\004\005\005\001\020\022\000\022\025\012\023\012\017\302\001\014\012\012\012\010\012\001\020\025\000\000\000\000\022\000\030\000\030\001\022\324\002\062\321\002\012\040\012\036\012\032\022\030\010\020\020\001\032\010\010\005\020\001\030\000\040\000\032\010\010\005\020\001\030\000\040\000\022\000\022\254\002\062\251\002\012\100\052\076\012\010\012\006\012\002\052\000\022\000\022\060\052\056\012\023\012\021\012\015\302\001\012\012\010\032\006\012\004\003\003\020\040\022\000\022\025\012\023\012\017\302\001\014\012\012\012\010\012\001\040\025\000\000\000\000\022\000\030\000\030\001\022\344\001\062\341\001\012\040\012\036\012\032\022\030\010\040\020\001\032\010\010\003\020\003\030\000\040\000\032\010\010\003\020\003\030\000\040\000\022\000\022\274\001\062\271\001\012\100\052\076\012\010\012\006\012\002\052\000\022\000\022\060\052\056\012\023\012\021\012\015\302\001\012\012\010\032\006\012\004\004\004\040\040\022\000\022\025\012\023\012\017\302\001\014\012\012\012\010\012\001\040\025\000\000\000\000\022\000\030\000\030\001\022\165\062\163\012\040\012\036\012\032\022\030\010\040\020\001\032\010\010\004\020\002\030\000\040\000\032\010\010\004\020\002\030\000\040\000\022\000\022\117\062\115\012\077\052\075\012\010\012\006\012\002\052\000\022\000\022\057\052\055\012\022\012\020\012\014\302\001\011\012\007\042\005\012\003\240\002\012\022\000\022\025\012\023\012\017\302\001\014\012\012\012\010\012\001\012\025\000\000\000\000\022\000\030\000\030\001\022\012\012\010\012\004\012\002\010\012\022\000

Explaining a binary protobuf file

If you have a file named binary_protobuf_file.pb containing binary protobuf and you want the contents of the file explained, then run this command, copy the resulting escaped-octal output, and paste it into the input box on this page. Your browser will probably stack-overflow if the file is larger than a few thousand bytes.

cat binary_protobuf_file.pb | hexdump --one-byte-octal --no-squeezing | sed s/^[[:xdigit:]]*// | sed 's/ *$//' | tr ' ' '\' | tr -d '\n'

Other tools

What is this

This protobuf explainer is a one-page webapp built with purescript-halogen and purescript-protobuf. Source repository is at https://github.com/jamesdbrock/protobuf-decoder-explainer.