private static function hash($str)
    {
        $hash = 0;
        $str = str_split($str, 1);
        foreach ($str as $char) {
            $hash = ($hash << 4) + ord($char);
            $g = $hash & (0xf << (self::INT_SIZE - 4));
            if ($g !== 0) {
                $hash = $hash ^ ($g >> self::INT_SIZE - 8);
                $hash = $hash ^ $g;
            }
        }
        return $hash;
    }