hash_seed#

Return the per-process random bytes that seed the hash function.

Synopsis#

my $seed = hash_seed();

The result is a byte string whose length depends on the hash algorithm built into the interpreter — commonly 4 bytes for the classic algorithms and 16 bytes for SipHash. Two interpreters started from the same program see different values; a single run sees the same value throughout its life.

The seed is sensitive. Anyone who learns it can construct keys that collide in your hashes and mount an algorithmic-complexity attack. Keep it out of logs and error messages.