Is protobuf serialisation canonical? By that I mean, if I create two proto 
messages from the same version of the proto definition and set the fields 
to the same values, will the two protos serialise to the same sequence of 
bytes?   Regardless of programming language/proto implementation 
version/etc?

The reason I ask is because I'm using serialised single-field protos as 
keys in a Kafka topic and I'm questioning if that's safe.  They key must 
serialise consistently otherwise things that should share a key may end up 
having different keys once serialised.

Is it safe to use protos in this way?  Is it safe to use a subset of protos 
in this way (for example, I think map fields are not canonically 
serilalised, because ordering is not defined, but maybe other field types 
are ok)?

Thanks,

Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to