Abstract interface of hash functions.
More...
|
virtual | ~Hash () |
| Virtual destructor.
|
|
virtual bool | add (const void *data, size_t size)=0 |
| Add some part of the message to hash. More...
|
|
virtual size_t | blockSize () const =0 |
| Size in bytes of the block used by the algorithm. More...
|
|
virtual bool | getHash (void *hash, size_t bufsize, size_t *retsize=nullptr)=0 |
| Get the resulting hash value. More...
|
|
bool | hash (const void *data, size_t data_size, ByteBlock &hash) |
| Compute a hash in one operation. More...
|
|
bool | hash (const void *data, size_t data_size, void *hash, size_t hash_maxsize, size_t *hash_retsize=nullptr) |
| Compute a hash in one operation. More...
|
|
virtual size_t | hashSize () const =0 |
| Size in bytes of the resulting hash. More...
|
|
virtual bool | init ()=0 |
| Reinitialize the computation of the hash. More...
|
|
virtual UString | name () const =0 |
| Algorithm name (informational only). More...
|
|
Abstract interface of hash functions.
◆ name()
virtual UString ts::Hash::name |
( |
| ) |
const |
|
pure virtual |
◆ hashSize()
virtual size_t ts::Hash::hashSize |
( |
| ) |
const |
|
pure virtual |
◆ blockSize()
virtual size_t ts::Hash::blockSize |
( |
| ) |
const |
|
pure virtual |
Size in bytes of the block used by the algorithm.
- Returns
- The size in bytes of the block used by the algorithm. Informational only. Can be zero if non significant.
Implemented in ts::SHA512, ts::SHA256, and ts::SHA1.
◆ init()
virtual bool ts::Hash::init |
( |
| ) |
|
|
pure virtual |
◆ add()
virtual bool ts::Hash::add |
( |
const void * |
data, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Add some part of the message to hash.
Can be called several times.
- Parameters
-
[in] | data | Address of message part. |
[in] | size | Size in bytes of message part. |
- Returns
- True on success, false on error.
Implemented in ts::SHA512, ts::SHA256, and ts::SHA1.
◆ getHash()
virtual bool ts::Hash::getHash |
( |
void * |
hash, |
|
|
size_t |
bufsize, |
|
|
size_t * |
retsize = nullptr |
|
) |
| |
|
pure virtual |
Get the resulting hash value.
- Parameters
-
[out] | hash | Address of returned hash buffer. |
[in] | bufsize | Size in bytes of hash buffer. |
[out] | retsize | Address of an integer receiving the actual returned hash size. Can be a null pointer (ignored). |
- Returns
- True on success, false on error.
Implemented in ts::SHA512, ts::SHA256, and ts::SHA1.
◆ hash() [1/2]
bool ts::Hash::hash |
( |
const void * |
data, |
|
|
size_t |
data_size, |
|
|
void * |
hash, |
|
|
size_t |
hash_maxsize, |
|
|
size_t * |
hash_retsize = nullptr |
|
) |
| |
Compute a hash in one operation.
Same in init() + add() + getHash().
- Parameters
-
[in] | data | Address of message to hash. |
[in] | data_size | Size in bytes of message to hash. |
[out] | hash | Address of returned hash buffer. |
[in] | hash_maxsize | Size in bytes of hash buffer. |
[out] | hash_retsize | Address of an integer receiving the actual returned hash size. Can be a null pointer (ignored). |
- Returns
- True on success, false on error.
◆ hash() [2/2]
bool ts::Hash::hash |
( |
const void * |
data, |
|
|
size_t |
data_size, |
|
|
ByteBlock & |
hash |
|
) |
| |
Compute a hash in one operation.
Same in init() + add() + getHash().
- Parameters
-
[in] | data | Address of message to hash. |
[in] | data_size | Size in bytes of message to hash. |
[out] | hash | Returned hash buffer. |
- Returns
- True on success, false on error.
The documentation for this class was generated from the following file: