Perl version of dir_hash_c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/


[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux