NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class ChunkHash

Encapsulates the creation of a hash from streamed chunks of data

  Aws\Common\Hash\ChunkHash implements Aws\Common\Hash\ChunkHashInterface

Namespace: Aws\Common\Hash
Located at Aws/Common/Hash/ChunkHash.php

## Methods summary

- `public` `__construct ( string $algorithm = `Aws\Common\Hash\ChunkHashInterface::DEFAULT_ALGORITHM` )`

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

- `public` `addData ( string $data )`

  Add a chunk of data to be hashed

- `public` `getHash ( bool $returnBinaryForm = false )`

  Return the results of the hash

- `public` `__clone ( )`

## Methods detail

# `public `Aws\Common\Hash\ChunkHash``
`__construct( string $algorithm = `Aws\Common\Hash\ChunkHashInterface::DEFAULT_ALGORITHM` )`

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

#### Parameters

$algorithm
  `string`
  $algorithm A valid hash algorithm name as returned by `hash_algos()`

#### Returns

``Aws\Common\Hash\ChunkHash``

#### Implementation of

`Aws\Common\Hash\ChunkHashInterface::__construct()`
# `public `Aws\Common\Hash\ChunkHash``
`addData( string $data )`

Add a chunk of data to be hashed

#### Parameters

$data
  `string`
  $data Data to be hashed

#### Returns

``Aws\Common\Hash\ChunkHash``

#### Implementation of

`Aws\Common\Hash\ChunkHashInterface::addData()`
# `public string`
`getHash( boolean $returnBinaryForm = false )`

Return the results of the hash

#### Parameters

$returnBinaryForm
  `boolean`
  $returnBinaryForm If true, returns the hash in binary form instead of hex form

#### Returns

`string`

#### Implementation of

`Aws\Common\Hash\ChunkHashInterface::getHash()`
# `public`
`__clone( )`

### Magic methods summary

## Constants summary

### Constants inherited from Aws\Common\Hash\ChunkHashInterface

`DEFAULT_ALGORITHM`

## Properties summary

`protected resource` | $context | # The hash context as created by `hash_init()`
`protected string` | $hash | # The resulting hash in hex form
`protected string` | $hashRaw | # The resulting hash in binary form