Answer the question
In order to leave comments, you need to log in
How to quickly create a hash that fully identifies an array?
I use the floating version
function jmd5($input)
{
return md5(json_encode($input));
}
Answer the question
In order to leave comments, you need to log in
Maybe try xxHash ?
Name Speed Quality Author
xxHash 5.4 GB/s 10 Y.C.
MurmurHash 3a 2.7 GB/s 10 Austin Appleby
SBox 1.4 GB/s 9 Bret Mulvey
Lookup3 1.2 GB/s 9 Bob Jenkins
CityHash64 1.05 GB/s 10 Pike & Alakuijala
FNV 0.55 GB/s 5 Fowler, Noll, Vo
CRC32 0.43 GB/s 9
MD5-32 0.33 GB/s 10 Ronald L.Rivest
SHA1-32 0.28 GB/s 10
Fully identifying - no way , because any hashing can cause collisions .
Of course, there are faster algorithms than md5, but the shorter the hash, the greater the chance of collisions.
(benchmarks 1 , 2 , 3 )
Hint: isn't serialize faster than json_encode?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question