mardi 23 mars 2021

Calculating std::hash using different compilers

I need to calculate the hash of a large string in windows and linux, and the result should be the same for both OS.

For a simple test code, I get different hashes for windows and linux using std::hash. This makes sense, since the actual implementation of std::hash for each compiler might use different algorithms.

Which brings the question: Is there a way to achieve this using the standard library?

The more straight forward answer for me is to implement my own hash algorithm, so its the same for both OS. But this seems like an overkill. I don't want to reinvent the wheel.

Aucun commentaire:

Enregistrer un commentaire