Documentation

ChunkHash
in package
implements ChunkHashInterface

Encapsulates the creation of a hash from streamed chunks of data

Table of Contents

Interfaces

ChunkHashInterface
Interface for objects that encapsulate the creation of a hash from streamed chunks of data

Properties

$context  : resource
$hash  : string
$hashRaw  : string

Methods

__clone()  : mixed
{@inheritdoc}
__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

Properties

$context

protected resource $context

The hash context as created by hash_init()

$hash

protected string $hash

The resulting hash in hex form

$hashRaw

protected string $hashRaw

The resulting hash in binary form

Methods

__clone()

{@inheritdoc}

public __clone() : mixed

__construct()

Constructs the chunk hash and sets the algorithm to use for hashing

public __construct([mixed $algorithm = self::DEFAULT_ALGORITHM ]) : self
Parameters
$algorithm : mixed = self::DEFAULT_ALGORITHM

A valid hash algorithm name as returned by hash_algos()

Return values
self

addData()

Add a chunk of data to be hashed

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

Data to be hashed

Return values
self

getHash()

Return the results of the hash

public getHash([mixed $returnBinaryForm = false ]) : string
Parameters
$returnBinaryForm : mixed = false

If true, returns the hash in binary form instead of hex form

Return values
string

        
On this page

Search results