hash_value#

Return the integer hash value of a string under the current (or a supplied) seed.

Synopsis#

my $h = hash_value($string); my $h = hash_value($string, $seed);

With one argument, hashes $string with the interpreter’s per-process seed — the same seed reported by hash_seed. With a second argument, hashes it with $seed instead, letting you compute what the hash value would be under a different seed. The custom seed must be at least as long as hash_seed produces; a shorter $seed croaks with seed len must be at least N long only got M bytes.

The one-argument value is stable for the lifetime of a single interpreter and unstable across runs, Perl versions, build options, and architectures. Do not persist it.

Like hash_seed, the result is sensitive information that can be used to engineer collisions. Treat it accordingly.