t-kuni / php-pearson-hashing
Installs: 280
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/t-kuni/php-pearson-hashing
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2025-10-10 19:22:41 UTC
README
Implementation of Pearson Hashing algorithm for PHP.
Installation
composer require t-kuni/php-pearson-hashing
Usage
use TKuni\PhpPearsonHashing\PearsonHasher;
$hasher = new PearsonHasher();
echo $hasher->hash(8, 'any message');
Output:
82eed2e9264c7400
Description Of hash()
public function hash(int $length, string $data, bool $raw_output = false)
Parameters
- length
- hash length in bytes.
- message
- Message to be hashed.
- raw_output
- When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits.
Return Values
Returns a string containing the calculated message digest as lowercase hexits unless raw_output is set to true in which case the raw binary representation of the message digest is returned.