定制 kduma/pkv 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

kduma/pkv

最新稳定版本:v0.0.1

Composer 安装命令:

composer require kduma/pkv

包简介

Partial Key Verification Library for PHP

README 文档

README

Latest Version on Packagist Tests Total Downloads

This is a port of my other C# library Partial Key Verification Library for Compact Framework into a PHP package.

This library implements Partial Key Verification (PKV). PKV is a cryptographic technique that allows verification of a subset of a key without revealing the entire key, enhancing security and privacy in various applications.

Check full documentation here: opensource.duma.sh/libraries/php/partial-key-verification

Installation

You can install the package via composer:

composer require kduma/pkv

Usage

private static function validateKey(string $key): bool {
	$seed = \KDuma\PKV\PartialKeyValidator::getSerialNumberFromKey($key);
	$blacklist = [1518008798, 42];
	if (in_array($seed, $blacklist, true))
		return false;

	// Validation for key with index 1
	if (!\KDuma\PKV\PartialKeyValidator::validateKey(new \KDuma\PKV\Checksum\Adler16(), new \KDuma\PKV\Hash\OneAtATime(), $key, 1, 766109221))
		return false;

	// Validation for key with index 4
	if (!\KDuma\PKV\PartialKeyValidator::validateKey(new \KDuma\PKV\Checksum\Adler16(), new \KDuma\PKV\Hash\Fnv1a(), $key, 4, 4072442218))
		return false;

	return true;
}

Testing

composer test

Credits

License

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

Packagist

View this package on Packagist.org: kduma/pkv

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-04