189900/wyhash

wyhash 的 PHP 版本

0.2.0 2023-08-09 19:49 UTC

This package is auto-updated.

Last update: 2024-09-13 14:32:04 UTC


README

Latest Version Build Status

189900/wyhash 是 Wang Yi 开发的 wyhash 算法的 PHP 实现

生成的哈希值与 最终版本 4 兼容。

安装

此包可以作为 Composer 依赖项安装。

composer require 189900/wyhash

使用方法

使用静态调用

use N189900\Wyhash\Hasher;

$hash = Hasher::hash('payload bytes');

使用 hasher 实例

use N189900\Wyhash\Hasher;

$hasher = new Hasher('123'); // optional custom seed
$hash = $hasher->final('payload bytes');

使用一系列更新(支持流式数据,优化内存使用)

use N189900\Wyhash\Hasher;

$hasher = new Hasher();
$hasher->update('first chunk');
$hasher->update('second chunk');
$hash = $hasher->final('optional closing chunk');

许可证

MIT 许可证(MIT)。更多信息请参阅 LICENSE