class Hasher

An abstract hashing class. More...

Contains pure virtuals
Full nameTelEngine::Hasher
Definition#include <yateclass.h>
Inherited byMD5, SHA1, SHA256
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Protected Members


Detailed Description

Abstract base class representing a hash calculator

 ~Hasher ()

~Hasher

[virtual]

Destroy the instance, free allocated memory

void  clear ()

clear

[pure virtual]

Clear the digest and prepare for reuse

void  finalize ()

finalize

[pure virtual]

Finalize the digest computation, make result ready. Subsequent calls to update() will fail

const unsigned char*  rawDigest ()

rawDigest

[pure virtual]

Returns a pointer to the raw 16-byte binary value of the message digest. The digest is finalized if if wasn't already

Returns: Pointer to the raw digest data or NULL if some error occured

inline const String&  hexDigest ()

hexDigest

Returns the standard hexadecimal representation of the message digest. The digest is finalized if if wasn't already

Returns: A String which holds the hex digest or a null one if some error occured

inline bool  update (const void* buf, unsigned int len)

update

Update the digest from a buffer of data

Parameters:
bufPointer to the data to be included in digest
lenLength of data in the buffer

Returns: True if success, false if finalize() was already called

inline bool  update (const DataBlock& data)

update

Update the digest from the content of a DataBlock

Parameters:
dataData to be included in digest

Returns: True if success, false if finalize() was already called

inline bool  update (const String& str)

update

Update the digest from the content of a String

Parameters:
strString to be included in digest

Returns: True if success, false if finalize() was already called

inline Hasher&  operator<< (const String& value)

operator<<

Digest updating operator for Strings

Parameters:
valueString to be included in digest

inline Hasher&  operator<< (const DataBlock& data)

operator<<

Digest updating operator for DataBlocks

Parameters:
dataData to be included in digest

Hasher&  operator<< (const char* value)

operator<<

Digest updating operator for C strings

Parameters:
valueString to be included in digest

bool  hmacStart (DataBlock& opad, const void* key, unsigned int keyLen)

hmacStart

Start a HMAC calculation, initialize the hash and the outer pad

Parameters:
opadOuter pad to be filled from key
keySecret key
keyLenSecret key length

Returns: True if hash and outer pad were successfully initialized

inline bool  hmacStart (DataBlock& opad, const DataBlock& key)

hmacStart

Start a HMAC calculation, initialize the hash and the outer pad

Parameters:
opadOuter pad to be filled from key
keySecret key

Returns: True if hash and outer pad were successfully initialized

inline bool  hmacStart (DataBlock& opad, const String& key)

hmacStart

Start a HMAC calculation, initialize the hash and the outer pad

Parameters:
opadOuter pad to be filled from key
keySecret key string

Returns: True if hash and outer pad were successfully initialized

bool  hmacFinal (const DataBlock& opad)

hmacFinal

Finalize a HMAC calculation with this hash

Parameters:
opadOuter pad as filled by hmacStart

Returns: True on success, HMAC result is left in hasher

bool  hmac (const void* key, unsigned int keyLen, const void* msg, unsigned int msgLen)

hmac

Compute a Message Authentication Code with this hash

Parameters:
keySecret key
keyLenSecret key length
msgMessage to authenticate
msgLenMessage length

Returns: True if HMAC was computed correctly, result is left in hasher

inline bool  hmac (const DataBlock& key, const DataBlock& msg)

hmac

Compute a Message Authentication Code with this hash

Parameters:
keySecret key
msgMessage to authenticate

Returns: True if HMAC was computed correctly, result is left in hasher

inline bool  hmac (const String& key, const String& msg)

hmac

Compute a Message Authentication Code with this hash

Parameters:
keySecret key string
msgMessage string to authenticate

Returns: True if HMAC was computed correctly, result is left in hasher

unsigned int  hashLength ()

hashLength

[const pure virtual]

Return the length of the raw binary digest

Returns: Length of the digest in octets

unsigned int  hmacBlockSize ()

hmacBlockSize

[const virtual]

Return the size of the block used in HMAC calculations

Returns: HMAC block size in octets, usually 64

inline  Hasher ()

Hasher

[protected]

Default constructor

bool  updateInternal (const void* buf, unsigned int len)

updateInternal

[protected pure virtual]

Update the digest from a buffer of data

Parameters:
bufPointer to the data to be included in digest
lenLength of data in the buffer

Returns: True if success, false if finalize() was already called

void* m_private

m_private

[protected]

String m_hex

m_hex

[protected]


Generated by: paulc on bussard on Fri May 8 12:37:22 2015, using kdoc 2.0a54.