proxy.php

Simple redirection proxy
git clone git://git.finwo.net/misc/proxy.php
Log | Files | Refs | README

hash.php (528B)


      1 <?php
      2 
      3 if (!function_exists('hash')) {
      4     function hash($algo, $input, $raw_output = false)
      5     {
      6         if (!is_string($input)) {
      7             $input = http_build_query($input);
      8         }
      9         $hash = 0;
     10         if (!strlen($input)) {
     11             return $hash;
     12         }
     13         $input = str_split($input);
     14         while (count($input)) {
     15             $character = ord(array_shift($input));
     16             $hash      = (($hash << 5) - $hash) + $character;
     17         }
     18 
     19         return $raw_output ? $hash : dechex($hash);
     20     }
     21 }