Questions tagged [hashing]
30 questions
13
votes
3 answers
How to calculate SHA256 of a number, not string
Mathematica always interprets the input of the Hash function as a string. I would expect this:
IntegerString[
Hash[FromDigits["00010966776006953D5567439E5E39F86A0D273BEE", 16],
"SHA256"], 16, 64]
to give…
Jan Hubik
- 457
- 3
- 10
8
votes
1 answer
How to define your own hash type?
Currently Mathematica offers support of a bunch of different hash algorithms. I would like to add my own to the list. In this way I can still use the function Hash[]. This allows me to switch between one of Mathematica's predefined algorithms, say…
9Harris
- 175
- 6
5
votes
2 answers
Why should we make sure the calculated MD5 is of length 32?
I see when people write code on calculating MD5, (even in the documentation), they write like this:
IntegerString[Hash[something, "MD5"], 16, 32]
But I think that Hash[something, "MD5"] already returns the 128-bit MD5, and I observed that…
vapor
- 7,911
- 2
- 22
- 55
1
vote
0 answers
Is this a serious flaw in Mathematica's default hashing algorithm
Below, I define two expressions X and Y (which arose in the wild!) such that not only
Hash[X] == Hash[Y]
but
Hash[{1}~Join~X] == Hash[{1}~Join~Y]
(and similarly for prepending and appending other lists), but X =!= Y (hint: look at the rule for…
Scott Morrison
- 1,251
- 8
- 14