承接 xp-forge/hashing 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xp-forge/hashing

最新稳定版本:v3.0.0

Composer 安装命令:

composer require xp-forge/hashing

包简介

Hashing library

关键字:

README 文档

README

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.4+ Supports PHP 8.0+ Latest Stable Version

Fluent interface to hashing functions provided by PHP, extended with Murmur3.

Examples

Calculate hash for a string, output using base32:

use text\hash\Hashing;

$hash= Hashing::murmur3_32()->new($seed= 0x2a);
$base32= $hash->digest('The quick brown fox jumps over the lazy dog.')->base32();

Incrementally updating hash, output hex (much like the builtin md5() function does):

use text\hash\Hashing;

$hash= Hashing::md5()->new();
while ($stream->available()) {
  $hash->update($stream->read());
}

$hex= $hash->digest()->hex();

Comparing hashes using constant time comparison:

use text\hash\{Hashing, HashCode};

$computed= Hashing::sha256()->digest($req->param('password')); // From request
$stored= HashCode::fromHex($record['password_hash']);          // From database

if ($computed->equals($stored)) {
  // Not susceptible to timing attacks
}

Algorithms

The following algorithms exist as shortcuts inside the entry point class:

  • Hashing::md5()
  • Hashing::sha1()
  • Hashing::sha256()
  • Hashing::sha512()
  • Hashing::murmur3_32()
  • Hashing::murmur3_128()

Other algorithms can be instantiated via Hashing::algorithm(string $name, var... $args), which may raise an IllegalArgumentException if the given algorithm is not available.

统计信息

  • 总下载量: 12.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-08-12