(proto3 question)
Suppose I have some messages Foo and Bar, where Bar represents data for objects that are related to some Foo. I send the whole bunch of them in some set like so:
message MyMessage{
repeated Foo = 1;
repeated Bar = 2;
}
What I'd like is for Bar to have a structure like:
message Bar{
...
int foo_id = 100;
}
where foo_id is the hash of the Foo protobuf that is associated with that given Bar protobuf.
Now I know I could probably do something like bar.set_foo_id(md5(fooProto.SerializeAsString())) where i use md5 to just represent some common hashing function that should exist for the several languages, and just have it hash the serialized string of data. What I'm more wondering is if there's something more simple like bar.set_foo_id(fooProto.hash()), that will generate a consistent foo_id value between different platforms.
Specifically, I'm doing this in c++ and javascript. I see the hashing seems to exist in java. I haven't found a similar function within the c++ source, but that could just be something I haven't found; and I haven't yet looked on the javascript side of things.