Yate
|
An abstract hashing class. More...
#include <yateclass.h>
Public Member Functions | |
virtual | ~Hasher () |
virtual void | clear ()=0 |
virtual void | finalize ()=0 |
virtual const unsigned char * | rawDigest ()=0 |
const String & | hexDigest () |
bool | update (const void *buf, unsigned int len) |
bool | update (const DataBlock &data) |
bool | update (const String &str) |
Hasher & | operator<< (const String &value) |
Hasher & | operator<< (const DataBlock &data) |
Hasher & | operator<< (const char *value) |
bool | hmacStart (DataBlock &opad, const void *key, unsigned int keyLen) |
bool | hmacStart (DataBlock &opad, const DataBlock &key) |
bool | hmacStart (DataBlock &opad, const String &key) |
bool | hmacFinal (const DataBlock &opad) |
bool | hmac (const void *key, unsigned int keyLen, const void *msg, unsigned int msgLen) |
bool | hmac (const DataBlock &key, const DataBlock &msg) |
bool | hmac (const String &key, const String &msg) |
virtual unsigned int | hashLength () const =0 |
virtual unsigned int | hmacBlockSize () const |
Protected Member Functions | |
Hasher () | |
virtual bool | updateInternal (const void *buf, unsigned int len)=0 |
Protected Attributes | |
void * | m_private |
String | m_hex |
An abstract hashing class.
Abstract base class representing a hash calculator
|
virtual |
Destroy the instance, free allocated memory
|
inlineprotected |
Default constructor
|
pure virtual |
|
pure virtual |
Finalize the digest computation, make result ready. Subsequent calls to update() will fail
Implemented in SHA256, SHA1, and MD5.
Referenced by Hasher::hexDigest().
|
pure virtual |
|
inline |
Returns the standard hexadecimal representation of the message digest. The digest is finalized if if wasn't already
References Hasher::finalize().
Referenced by ClientContact::buildIdHash().
bool hmac | ( | const void * | key, |
unsigned int | keyLen, | ||
const void * | msg, | ||
unsigned int | msgLen | ||
) |
Compute a Message Authentication Code with this hash
Referenced by Hasher::hmac().
Compute a Message Authentication Code with this hash
key | Secret key |
msg | Message to authenticate |
References DataBlock::data(), Hasher::hmac(), and DataBlock::length().
Compute a Message Authentication Code with this hash
key | Secret key string |
msg | Message string to authenticate |
References String::c_str(), Hasher::hmac(), and String::length().
|
virtual |
Return the size of the block used in HMAC calculations
bool hmacFinal | ( | const DataBlock & | opad | ) |
Finalize a HMAC calculation with this hash
opad | Outer pad as filled by hmacStart |
bool hmacStart | ( | DataBlock & | opad, |
const void * | key, | ||
unsigned int | keyLen | ||
) |
Start a HMAC calculation, initialize the hash and the outer pad
opad | Outer pad to be filled from key |
key | Secret key |
keyLen | Secret key length |
Referenced by Hasher::hmacStart().
Start a HMAC calculation, initialize the hash and the outer pad
opad | Outer pad to be filled from key |
key | Secret key |
References DataBlock::data(), Hasher::hmacStart(), and DataBlock::length().
Start a HMAC calculation, initialize the hash and the outer pad
opad | Outer pad to be filled from key |
key | Secret key string |
References String::c_str(), Hasher::hmacStart(), and String::length().
Digest updating operator for Strings
value | String to be included in digest |
References Hasher::update().
Digest updating operator for DataBlocks
data | Data to be included in digest |
References Hasher::update().
Hasher& operator<< | ( | const char * | value | ) |
Digest updating operator for C strings
value | String to be included in digest |
|
pure virtual |
|
inline |
Update the digest from a buffer of data
buf | Pointer to the data to be included in digest |
len | Length of data in the buffer |
References Hasher::updateInternal().
Referenced by Hasher::operator<<().
|
inline |
Update the digest from the content of a DataBlock
data | Data to be included in digest |
References DataBlock::data(), DataBlock::length(), and Hasher::updateInternal().
|
inline |
Update the digest from the content of a String
str | String to be included in digest |
References String::c_str(), String::length(), and Hasher::updateInternal().
|
protectedpure virtual |
Update the digest from a buffer of data
buf | Pointer to the data to be included in digest |
len | Length of data in the buffer |
Implemented in SHA256, SHA1, and MD5.
Referenced by Hasher::update().