Skip to content

Commit 34b37fa

Browse files
yecril71plkhwilliamson
authored andcommitted
Document Hash::Util::hash_value($string, $seed)
Returns the hash value as if computed with a different seed.
1 parent f7891bf commit 34b37fa

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

ext/Hash-Util/lib/Hash/Util.pm

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,22 @@ Perl has been built with. Possible sizes may be but are not limited to
510510
=item B<hash_value>
511511
512512
my $hash_value = hash_value($string);
513-
514-
hash_value() returns the current perl's internal hash value for a given
515-
string.
516-
517-
Returns a 32 bit integer representing the hash value of the string passed
518-
in. This value is only reliable for the lifetime of the process. It may
519-
be different depending on invocation, environment variables, perl version,
513+
my $hash_value = hash_value($string, $seed);
514+
515+
C<hash_value($string)>
516+
returns
517+
the current perl's internal hash value for a given string.
518+
C<hash_value($string, $seed)>
519+
returns the hash value as if computed with a different seed.
520+
If the custom seed is too short, the function errors out.
521+
The minimum length of the seed is implementation-dependent.
522+
523+
Returns a 32-bit integer
524+
representing the hash value of the string passed in.
525+
The 1-parameter value is only reliable
526+
for the lifetime of the process.
527+
It may be different
528+
depending on invocation, environment variables, perl version,
520529
architectures, and build options.
521530
522531
B<Note that the hash value of a given string is sensitive information>:
@@ -833,6 +842,9 @@ hv_store() is from Array::RefElem, Copyright 2000 Gisle Aas.
833842
834843
Additional code by Yves Orton.
835844
845+
Description of C<hash_value($string, $seed)>
846+
by Christopher Yeleighton <[email protected]>
847+
836848
=head1 SEE ALSO
837849
838850
L<Scalar::Util>, L<List::Util> and L<perlsec/"Algorithmic Complexity Attacks">.

0 commit comments

Comments
 (0)