Skip to main content
Minor clean-up
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

How Mathematica hash functiondoes Hash calculate hash for strings?

I have this code

Hash["a","SHA"]
Hash[ToCharacterCode["a"],"SHA"]

and I was expecting to get the same result, but somehow it is different.

My question is: how does Mathematica calculates hashcalculate hashing for strings? From common sense it should convert a string to integer and calculate it for some integer. If so, how does it convert the string to integer?

How Mathematica hash function calculate hash for strings?

I have this code

Hash["a","SHA"]
Hash[ToCharacterCode["a"],"SHA"]

and I was expecting to get the same result, but somehow it is different.

My question is how Mathematica calculates hash for strings? From common sense it should convert a string to integer and calculate it for some integer. If so, how does it convert the string to integer?

How does Hash calculate hash for strings?

I have this code

Hash["a","SHA"]
Hash[ToCharacterCode["a"],"SHA"]

and I was expecting to get the same result, but somehow it is different.

My question is: how does Mathematica calculate hashing for strings? From common sense it should convert a string to integer and calculate it for some integer. If so, how does it convert the string to integer?

Tweeted twitter.com/StackMma/status/934054285998022657
Source Link
Zlelik
  • 531
  • 2
  • 8

How Mathematica hash function calculate hash for strings?

I have this code

Hash["a","SHA"]
Hash[ToCharacterCode["a"],"SHA"]

and I was expecting to get the same result, but somehow it is different.

My question is how Mathematica calculates hash for strings? From common sense it should convert a string to integer and calculate it for some integer. If so, how does it convert the string to integer?