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
You can install the package via composer:
composer require kduma/pkv
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;
}
composer test
The MIT License (MIT). Please see License File for more information.
View this package on Packagist.org: kduma/pkv