|  | Posted by opensourcearts on 01/02/08 21:18 
hello there,
 hash_file means something new in php5, and it seems to of broken my
 code:
 
 function hash_file ($strFilename) {
 $n = 0;
 for ($posFilename = strlen($strFilename) -1; $posFilename >= 0;
 $posFilename-- ) {
 $n *= 2;
 if ($n & 4096) { $n |= 1; }
 $n ^= (ord($strFilename[$posFilename])*11);
 $n &= 4095;
 }
 
 return sprintf ("%02o/%02o", ($n/64) & 63 , $n&63);
 }
 
 For now, the error that I get with the above code is just:
 
 
 PHP Fatal error:  Cannot redeclare hash_file()
 
 Is there some way to rewrite the above code, or something to
 substitute for hash_file?  Thanks!
 
 The original coder also wrote this comment with the code:
 
 // Don't even ask me how this works.  Apparently it creates a
 register for the filenme
 // by xoring the characters into a number from right to left.  The
 top six bits and the
 // bottom six bits are returned as the path name.  I didn't write it
 though, I just
 // converted it from a perl function that I found in the pair
 Networks private newsgroups.
 // - Jason
 
 Thanks for your help!
  Navigation: [Reply to this message] |