Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

SDK for PHP 3.x

PhpHash
in package
implements HashInterface

Incremental hashing using PHP's hash functions.

Table of Contents

Interfaces

HashInterface
Interface that allows implementing various incremental hashes.

Methods

__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.

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.

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

update()

Adds data to the hash.

public update(mixed $data) : mixed
Parameters
$data : mixed

Data to add to the hash

On this page