ChunkHashInterface
in
Interface for objects that encapsulate the creation of a hash from streamed chunks of data
Table of Contents
Constants
- DEFAULT_ALGORITHM = 'sha256'
Methods
- __construct() : self
- Constructs the chunk hash and sets the algorithm to use for hashing
- addData() : self
- Add a chunk of data to be hashed
- getHash() : string
- Return the results of the hash
Constants
DEFAULT_ALGORITHM
public
mixed
DEFAULT_ALGORITHM
= 'sha256'
Methods
__construct()
Constructs the chunk hash and sets the algorithm to use for hashing
public
__construct([string $algorithm = 'sha256' ]) : self
Parameters
- $algorithm : string = 'sha256'
-
A valid hash algorithm name as returned by
hash_algos()
Return values
selfaddData()
Add a chunk of data to be hashed
public
addData(string $data) : self
Parameters
- $data : string
-
Data to be hashed
Return values
selfgetHash()
Return the results of the hash
public
getHash([bool $returnBinaryForm = false ]) : string
Parameters
- $returnBinaryForm : bool = false
-
If true, returns the hash in binary form instead of hex form