Example #1
0
 /**
  * Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case
  * encoding, zero padded to 31 digits.
  *
  * 160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36
  * fairly neatly.
  *
  * @param string $path
  * @return bool|string False on failure
  */
 public static function getSha1Base36FromPath($path)
 {
     $fsFile = new self($path);
     return $fsFile->getSha1Base36();
 }
Example #2
0
 /**
  * Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case
  * encoding, zero padded to 31 digits.
  *
  * 160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36
  * fairly neatly.
  *
  * @param $path string
  * @param $recache bool
  *
  * @return bool|string False on failure
  */
 public static function getSha1Base36FromPath($path, $recache = false)
 {
     static $sha1Base36 = array();
     if (!isset($sha1Base36[$path]) || $recache) {
         $fsFile = new self($path);
         $sha1Base36[$path] = $fsFile->getSha1Base36();
     }
     return $sha1Base36[$path];
 }