Goal:
I have many derived classes (later on there will probably be additional derived classes) which are stored inside a tree structure and I want to serialize each of those classes into a protobuffer and later encrypt the binary data (given by SerializetoArray). But each of those classes should be encrypted with a different key. So obviously if I want to decrypt it I need to know which key was used to encrypt.
Question:
Is there a easy way to assign a unique integer to each of those classes, so that the number is the same across runtimes on every system (Linux, MacOS, Windows etc.) and for every instance of the class? (It should also not change if the class gets a version update.)
One obvious solution would be to define a number manually, but that will be unpractical later on, since I hope that many of those derived classes will be designed by the community and thus it would be almost impossible to guarantee the uniqueness of them.
Is there a better solution?