PhpHash
in package
implements
HashInterface
Incremental hashing using PHP's hash functions.
Interfaces, Classes and Traits
- HashInterface
- Interface that allows implementing various incremental hashes.
Table of Contents
- $algo : string
- $context : resource|HashContext
- $hash : string
- $options : array<string|int, mixed>
- __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.
- getContext() : resource|HashContext
- Get a hash context or create one if needed
Properties
$algo
private
string
$algo
$context
private
resource|HashContext
$context
$hash
private
string
$hash
$options
private
array<string|int, mixed>
$options
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.
Return values
mixed —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
Return values
mixed —update()
Adds data to the hash.
public
update(mixed $data) : mixed
Parameters
- $data : mixed
-
Data to add to the hash
Return values
mixed —getContext()
Get a hash context or create one if needed
private
getContext() : resource|HashContext