Subject: | hash values are the same; crash |
Here are several examples where I don't think Hash::MD5 is working correctly.
use strict;
use warnings;
use Hash::MD5 qw( sum_hash );
# keys are different, but hash is same
print sum_hash({
a => '',
aaaa => '',
}), "\n";
# 6299dfa70679d91174c1d720693db234
print sum_hash({
aa => '',
aaa => '',
}), "\n";
# 6299dfa70679d91174c1d720693db234
# values are different, but hash is same
print sum_hash({
a => 'a',
aa => 'aaaaaaaaaaa',
}), "\n";
# 526c242fdd5554fadaa5df7e28a49666
print sum_hash({
a => 'aaaaaaaaaaa',
aa => 'a',
}), "\n";
# 526c242fdd5554fadaa5df7e28a49666
# number of keys is different, but hash is same
print sum_hash({
'aaaaaaaaaaaaaaa"' => '',
}), "\n";
# b1728471c8af05ae59afaa3ac8979b79
print sum_hash({
a => 'aa',
aa => 'aaaaaaaaaa'
}), "\n";
# b1728471c8af05ae59afaa3ac8979b79
# terminates with deep recursion error
my %x;
$x{a} = \%x;
print sum_hash(\%x), "\n";