It's built-in functionality in the .Net framework.
GetHashCode[
^] will do that.
There is however no guarantee that different versions of the framework will produce the same hash.
The keys are used by the framework to create and index hash collections.
Note that in .Net if 2 strings have the same content, they are actually the same object.