Lines Matching full:hash
25 * Data hash object used as seed when creating and verifying timestamps.
27 * To calculate the hash sum of some data, first create a data hash object and then
29 * fed to the hash calculator. You can then retrieve the resulting hash value using
30 * getHashedMessage() method but this closes the hash object and you can't add more
33 * Example 1 - new hash:
38 * $hash = new GTDataHash(GTHashAlgorithm::getByName('DEFAULT'));
39 * $hash->update(array(0, 1, 2));
40 * $hash->updateFile('data.txt');
42 * $hash->close();
44 * print_r($hash->getHashedMessage());
47 * Example 2 - hash with existing hash value:
55 * $hash = new GTDataHash(GTHashAlgorithm::getByName('SHA256'), $bytes);
58 * Example 3 - hash from dataImprint:
67 * $hash = GTDataHash::getInstance($dataImprint);
79 * Builds a new hash object with the given hashAlgorithm and hashedMessage.
89 * @param GTHashAlgorithm $hashAlgorithm hash algorithm to use
90 * @param array $hashedMessage hash bytes
115 throw new GTException("hash must be an array of bytes");
119 … throw new GTException("hash length does not match with that defined in hash algorithm");
129 * Updates this hash calculator with the given bytes.
132 * @param $bytes byte array to feed to this hash calculator
138 throw new GTException("hash calculator already closed");
148 throw new GTException("hash update failed with unknown error");
153 * Updates this hash calculator with the bytes from the given file.
156 * @param string $file file to feed to this hash calculator
162 throw new GTException("hash calculator already closed");
184 throw new GTException("hash updateFile failed with unknown error");
190 * Updates this hash calculator with the bytes from the given stream.
193 * @param $handle handle of the stream to feed to this hash calculator
199 throw new GTException("hash calculator already closed");
213 throw new GTException("hash updateStream failed with unknown error");
219 * Explicitly closes this hash calculator.
221 * After the hash calculator is closed all calls to update methods will throw an exception.
238 * Checks if this hash calculator is closed.
240 * @return bool true if this hash calculator is closed.
247 * Gets the GTHashAlgorithm used by this hash calculator.
256 * Gets the current hash bytes.
258 * This method will also close the hash calculator when called. After closing
273 * Gets the current hash data imprint.
275 * This method will also close the hash calculator when called. After closing
278 * Data imprint is an array of bytes consisting of GTHashAlgorithm->getGtid() + hash bytes
300 * DataImprint is an array of bytes consisting of GTHashAlgorithm->getGtid() and hash bytes.