Perl version of dir_hash_c

subscription at innter.net subscription at innter.net
Tue Jul 26 17:22:05 EDT 2011


Hello,

I have found that C and Perl versions (tools/rehash) of dir_hash_c have
different results. For part of mailboxes.

Perl code :

$n = 0;
foreach my $b (split(/ */, $auth_user)) {
    $n = (($n << 3) ^ ($n >> 5)) ^ ord($b);
}
$h = chr(ord('A') + ($n % 23));


./mbpath user.biz53p2
Result : A

./test.pl
Result : A

This is correct.

./mbpath user.eco1004724p1
Result : A

./test.pl
Result : J

This is wrong.
Can someone explain that is wrong in perl version and how to fix this?


Thanks


More information about the Info-cyrus mailing list