Hello SO community I need some hashing expertise:
some context
I am faced with the problem to compare two lists of objects. One instance of the list is in a .Net Core 2.0 application and the other in a .Net 4.5.2 application.
To compare the two lists (ensure that they are the same in both applications) I would like to calculate a hash of the list and exchange that between the apps. To calculate a hash of the list I'm using the approach described in this answer.
For this you need a hashcode of the objects in the list, and this is where my problem comes in: It seems a well known fact (1) that .Net core uses randomised hash code behaviour for strings. To calculate the hashcode of my objects I would need to include hashcodes of strings.
Leading to my question: Is it a good idea to calculate a hash of a string using SHA256?
The reasons why I would like to use it:
- Same output size (256 bit can be interpreted Int32)
- SHA should always produce the same output (also for future .Net/core versions)
- It is easier to share between the applications than a custom implementation
Are there better (more efficient, easier, less collisions) alternatives?