t-kuni/php-pearson-hashing

1.0.1 2019-12-10 05:35 UTC

This package is auto-updated.

Last update: 2024-09-10 17:12:56 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.