文件校验完整性验证器

6.3.0 2023-09-11 07:57 UTC

This package is auto-updated.

Last update: 2024-09-11 10:03:11 UTC


README

FCIV 兼容的用于哈希和验证文件的库。

该库符合 PSR-1PSR-4PSR-12 标准。

单元测试代码覆盖率 100%!

兼容性

  • Windows
  • POSIX(Linux、macOS、BSD、Solaris 等)

该库完全兼容 fciv.exe v2.05。

要求

  • >= PHP 7.4

依赖

安装

composer require typomedia/fciv

使用

验证器

use Typomedia\Fciv\Verifier\Verifier;

$verifier = new Verifier(); // Options: string $algo = 'md5|sha1|both'
$result = $verifier->verify(file_get_contents('fciv.xml')); // Options: string $data, $exclude = [], $path = null

哈希器

use Typomedia\Fciv\Hasher\Hasher;

$hasher = new Hasher(); // Options: string $algo = 'md5|sha1|both', array $types = []
$hasher->setEntries('src'); // Options: string $path, array $exclude = []
$result = $hasher->getResult();