ottosmops/hash

创建和验证哈希文件(清单文件)

v1.2.0 2020-06-30 08:36 UTC

This package is auto-updated.

Last update: 2024-09-10 16:17:20 UTC


README

Software License Latest Stable Version Build Status SensioLabsInsight Packagist Downloads

安装

composer require ottosmops/hash

用法

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

您可以将文件名传递给createManifest方法。文件名必须是相对于dir的路径。使用第三个参数可以关闭递归目录迭代器。不会扫描子目录。

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

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件