In perl.git, the branch smoke-me/yves_rand_hash_seed has been created
<
http://perl5.git.perl.org/perl.git/commitdiff/aaa2f4e1f22b93f83e8724762bf95e43e1bc1c55?hp=0000000000000000000000000000000000000000>
at aaa2f4e1f22b93f83e8724762bf95e43e1bc1c55 (commit)
- Log -----------------------------------------------------------------
commit aaa2f4e1f22b93f83e8724762bf95e43e1bc1c55
Author: Yves Orton <
deme...@gmail.com>
Date: Fri Oct 26 11:40:37 2012 +0200
Adds some hash related introspection routines to the hash:: namespace
hash::seed() - returns the current seed
hash::function_name() - returns the hash function
hash::value($string) - returns the hash value of a string
hash::bucket_info() - returns statistics about bucket utilization
of a hash. The first three arguements are keys in hash, buckets in
hash and used buckets in hash. If the hash actually has a hash array
allocated (they are lazily allocated on first update to facilitate
presetting the array size) the a list of counts of bucket lengths
follows, with the 0th count being of 0 empty buckets, 1st count
being the number of buckets with 1 key in it, etc. Only works on
non-magical (untied) hashes.
hash::bucket_array() - returns an arrayref which represents the
buckets of a hash. Each element is either an array ref containing
a list of keys in the bucket, or an integer represent K empty
buckets. Only works on non-magical (untied) hashes.
Currently these routines are undocumented and untested.
M ext/Hash-Util/lib/Hash/Util.pm
M universal.c
commit a42955bba50bf316de2a01d2cc41eb12f0ffd5f5
Author: Yves Orton <
deme...@gmail.com>
Date: Tue Oct 23 12:16:02 2012 +0200
Make perl support a variety of new hash algorithms
This patch adds several new hash algorithms which can be used
as perls hash function.
They are as follows:
Murmur Hash: (v3) from google, see i
From
http://code.google.com/p/smhasher/wiki/MurmurHash3
Superfast Hash: From Paul Hsieh.
From
http://www.azillionmonkeys.com/qed/hash.html
DJB2: a hash function from Daniel Bernstein
From
http://www.cse.yorku.ca/~oz/hash.html
SDBM: a hash function sdbm.
Also from
http://www.cse.yorku.ca/~oz/hash.html
They have all be converted into Perl's ugly macro format. I have not
done any proper testing to make sure this conversion is correct.
All of them use the random hash seed.
You can enable a given function by defining one of
PERL_HASH_FUNC_MURMUR
PERL_HASH_FUNC_SUPERFAST
PERL_HASH_FUNC_DJB2
PERL_HASH_FUNC_SDBM
If none are defined then the build will use the old hash which is
Bob Jenkin's "one at a time" hash.
A new define PERL_HASH_FUNC is provided which expands to a string
containing the name of the chosen hash implementation.
Setting PERL_HASH_SEED_DEBUG to 1 will make perl output the current
seed (changed to hex) and the hash function it has been built with.
M hv.h
M perl.c
commit f02069327755f28cf4eccf2e2d0ff3f83288bddd
Author: Yves Orton <
deme...@gmail.com>
Date: Mon Aug 27 08:54:50 2012 +0200
fix a hash key order dependency in cpan/autodie/t/hints_pod_examples.t
At the same time make part of the internals deterministic Just In Case.
Version bump on autodie to 2.13 as well.
M cpan/autodie/lib/Fatal.pm
M cpan/autodie/lib/
autodie.pm
M cpan/autodie/lib/autodie/
exception.pm
M cpan/autodie/lib/autodie/exception/
system.pm
M cpan/autodie/lib/autodie/
hints.pm
M cpan/autodie/t/hints_pod_examples.t
commit 3447a9c50243b1e4e3b97ee6c9c4ad01241958a8
Author: Yves Orton <
deme...@gmail.com>
Date: Mon Aug 27 08:57:19 2012 +0200
fix hash key ordering dependencies in cpan/CGI/.. tests
Hash seed randomization makes various tests fail as they depend
on a particular hash key ordering.
Note this is not a patch that has been pushed upstream.
M cpan/CGI/Changes
M cpan/CGI/lib/CGI.pm
M cpan/CGI/lib/CGI/Util.pm
M cpan/CGI/t/autoescape.t
M cpan/CGI/t/function.t
M cpan/CGI/t/html.t
commit 3dc555d5497de39e43597d9b05a38eb06d070e41
Author: Yves Orton <
deme...@gmail.com>
Date: Mon Aug 27 08:55:32 2012 +0200
fix hash key order dependency from cpan/Module-Pluggable/t/23depth.t
Hash seed randomization causes the order to change per process.
I have bumped Module-Pluggable's version here.
M cpan/Module-Pluggable/lib/Module/Pluggable.pm
M cpan/Module-Pluggable/t/23depth.t
commit 008f78923916c4d420db6ae01b313f59234b3d21
Author: Yves Orton <
deme...@gmail.com>
Date: Sat Oct 20 21:06:56 2012 +0200
rip out HvREHASH logic and replace it with random hash seed per process
The general idea of the HvREHASH() logic is to avoid hashing attacks by
noticing degenerate hash patterns and triggering the use of a random
seed.
However the attack is avoided if the attacker cannot predict the hash
ordering of the perl process they are talking to. By randomizing the
hash seed at perl process startup we make the ordering unpredictable
and remove the need for the HvREHASH logic and all of its overhead.
M MANIFEST
M dist/threads-shared/lib/threads/
shared.pm
M dist/threads-shared/shared.xs
M dist/threads-shared/t/blessed.t
M dump.c
M embedvar.h
D ext/Hash-Util-FieldHash/t/10_hash.t
M ext/Hash-Util/lib/Hash/Util.pm
M hv.c
M hv.h
M intrpvar.h
M perl.c
M sv.c
M sv.h
M t/lib/universal.t
M t/op/hash.t
M universal.c
M util.c
-----------------------------------------------------------------------
--
Perl5 Master Repository