ottosmops / hash

create and verify hash files
MIT License
1 stars 1 forks source link

Create and verify a hash manifest

Software License Latest Stable Version Build Status SensioLabsInsight Packagist Downloads

Installation

composer require ottosmops/hash

Usage

use Ottosmops\Hash\Hash;

$hash = New Hash(); // you can pass an algorithm into the constructor
$hash->createManifest($dir);
if (!$hash->verifyManifest($dir . 'manifest')) {
    print_r($this->messages);
} else {
    echo  sprintf('All files in %s have correct checksums ', $hash->manifest); 
}

You can pass a filename to the createManifest method. The filename must be a path relative to the dir. With the third parameter you can switch off the recursive directory iterator. No subdirectories will be scanned:

$md5 = New Hash();
$md5->createManifest($dir, "myfilename", false);

License

The MIT License (MIT). Please see License File for more information.