You are here

function hackedFileHasher::hash in Hacked! 8.2

Returns a hash of the given filename.

Ignores file line endings

File

src/hackedFileHasher.php, line 14

Class

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

Namespace

Drupal\hacked

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;
    }
  }
}