What is Perl's default hash implementation?

245 views Asked by At

According to perldoc perlsec

Alternative Hash Functions The source code includes multiple hash algorithms to choose from. While we believe that the default perl hash is robust to attack, we have included the hash function Siphash as a fall-back option. At the time of release of Perl 5.18.0 Siphash is believed to be of cryptographic strength. This is not the default as it is much slower than the default hash.

What is the default perl hash function? From the context we can infer it's not SIPHASH?

1

There are 1 answers

2
Evan Carroll On

From the INSTALL file in the source,

Since Perl 5.18 we have included support for multiple hash functions, although from time to time we change which functions we support, and which function is default (currently SBOX+STADTX on 64 bit builds and SBOX+ZAPHOD32 for 32 bit builds).

You can see that default in the source code in hv_func.h. So it seems for 64 bit builds it's StadtX "fast hash function" which is implemented in stadtx_hash.h.