Permalink
Browse files

Fix uncorrect hash function

  • Loading branch information...
Krevo committed Oct 17, 2017
1 parent 7582d04 commit 899d0fabd342630321c996844c0733624abfab10
Showing with 4 additions and 4 deletions.
  1. +4 −4 finduanswer.php
View
@@ -16,8 +16,8 @@ function _Urwigo.Hash(str)
*/
/*
* Urwhigo.Hash() is in fact a the Robert Sedgewick's Hash Algorithm
/*
* Urwhigo.Hash() is in fact a variant of the Robert Sedgewick's Hash Algorithm
*/
function RSHash($string) {
$a = 63689;
@@ -26,9 +26,9 @@ function RSHash($string) {
for ($i = 0, $x = strlen($string); $i < $x; $i++) {
$hash = $hash * $a + (int) ord($string[$i]);
$hash = $hash % 65535;
$hash = fmod($hash, 65535);
$a = $a * $b;
$a = $a % 65535;
$a = fmod($a, 65535);
}
return $hash;

0 comments on commit 899d0fa

Please sign in to comment.