Is protocol buffer serialization output fully deterministic?

老子叫甜甜 提交于 2019-12-01 19:05:28

In general, the same data will serialize in exactly the same way.

However, this is not guaranteed by the protobuf specifications. For example, the following differences in encoding are allowable and must decode to the same result in all conforming libraries:

  • Encoding fields in different order than the tag number order.
  • Encoding packed fields as unpacked.
  • Encoding integers as longer varint byte sequences than needed.
  • Encoding same (non-repeated) field multiple times.
  • Probably others.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!