Documentation

ChunkHashInterface

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

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
self

addData()

Add a chunk of data to be hashed

public addData(string $data) : self
Parameters
$data : string

Data to be hashed

Return values
self

getHash()

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

Return values
string

        
On this page

Search results