TreeHash
in package
implements
HashInterface
Encapsulates the creation of a tree hash from streamed data
Table of Contents
Interfaces
- HashInterface
- Interface that allows implementing various incremental hashes.
Constants
- EMPTY_HASH = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
- MB = 1048576
Methods
- __construct() : mixed
- addChecksum() : self
- Add a checksum to the tree hash directly
- 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.
Constants
EMPTY_HASH
public
mixed
EMPTY_HASH
= 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
MB
public
mixed
MB
= 1048576
Methods
__construct()
public
__construct([mixed $algorithm = 'sha256' ]) : mixed
Parameters
- $algorithm : mixed = 'sha256'
addChecksum()
Add a checksum to the tree hash directly
public
addChecksum(string $checksum[, bool $inBinaryForm = false ]) : self
Parameters
- $checksum : string
-
The checksum to add
- $inBinaryForm : bool = false
-
TRUE if checksum is in binary form
Tags
Return values
selfcomplete()
Finalizes the incremental hash and returns the resulting digest.
public
complete() : string
Return values
stringreset()
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