You are here

function hackedFileHasher::hash in Hacked! 7.2

Same name and namespace in other branches
  1. 6.2 includes/hacked_project.inc \hackedFileHasher::hash()

Returns a hash of the given filename.

Ignores file line endings

File

includes/hackedFileHasher.inc, line 12

Class

hackedFileHasher
Base class for the different ways that files can be hashed.

Code

function hash($filename) {
  if (file_exists($filename)) {
    if ($hash = $this
      ->cache_get($filename)) {
      return $hash;
    }
    else {
      $hash = $this
        ->perform_hash($filename);
      $this
        ->cache_set($filename, $hash);
      return $hash;
    }
  }
}