SDK for PHP 3.x

PhpHash
in package
implements HashInterface

Incremental hashing using PHP's hash functions.

Table of Contents

Interfaces

HashInterface
Interface that allows implementing various incremental hashes.

Methods

__construct()  : mixed
complete()  : string
Finalizes the incremental hash and returns the resulting digest.
reset()  : mixed
Removes all data from the hash, effectively starting a new hash.
update()  : mixed
Adds data to the hash.

Methods

__construct()

public __construct(string $algo[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$algo : string

Hashing algorithm. One of PHP's hash_algos() return values (e.g. md5, sha1, etc...).

$options : array<string|int, mixed> = []

Associative array of hashing options:

  • key: Secret key used with the hashing algorithm.
  • base64: Set to true to base64 encode the value when complete.

complete()

Finalizes the incremental hash and returns the resulting digest.

public complete() : string
Return values
string

reset()

Removes all data from the hash, effectively starting a new hash.

public reset() : mixed

update()

Adds data to the hash.

public update(mixed $data) : mixed
Parameters
$data : mixed

Data to add to the hash

On this page