Yate
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SHA256 Class Reference

A standard SHA256 digest calculator. More...

#include <yateclass.h>

Inheritance diagram for SHA256:
Hasher

Public Member Functions

 SHA256 ()
 
 SHA256 (const SHA256 &original)
 
 SHA256 (const void *buf, unsigned int len)
 
 SHA256 (const DataBlock &data)
 
 SHA256 (const String &str)
 
SHA256operator= (const SHA256 &original)
 
virtual ~SHA256 ()
 
virtual void clear ()
 
virtual void finalize ()
 
virtual const unsigned char * rawDigest ()
 
virtual unsigned int hashLength () const
 
- Public Member Functions inherited from Hasher
virtual ~Hasher ()
 
const StringhexDigest ()
 
bool update (const void *buf, unsigned int len)
 
bool update (const DataBlock &data)
 
bool update (const String &str)
 
Hasheroperator<< (const String &value)
 
Hasheroperator<< (const DataBlock &data)
 
Hasheroperator<< (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 hmacBlockSize () const
 

Static Public Member Functions

static unsigned int rawLength ()
 

Protected Member Functions

bool updateInternal (const void *buf, unsigned int len)
 
- Protected Member Functions inherited from Hasher
 Hasher ()
 

Additional Inherited Members

- Protected Attributes inherited from Hasher
void * m_private
 
String m_hex
 

Detailed Description

A standard SHA256 digest calculator.

A class to compute and check SHA256 digests

Constructor & Destructor Documentation

SHA256 ( )

Construct a fresh initialized instance

SHA256 ( const SHA256 original)

Copy constructor

Parameters
originalSHA256 instance to copy
SHA256 ( const void *  buf,
unsigned int  len 
)

Construct a digest from a buffer of data

Parameters
bufPointer to the data to be included in digest
lenLength of data in the buffer
SHA256 ( const DataBlock data)

Construct a digest from a binary DataBlock

Parameters
dataBinary data to be included in digest
SHA256 ( const String str)

Construct a digest from a String

Parameters
strString to be included in digest
virtual ~SHA256 ( )
virtual

Destroy the instance, free allocated memory

Member Function Documentation

virtual void clear ( )
virtual

Clear the digest and prepare for reuse

Implements Hasher.

virtual void finalize ( )
virtual

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

Implements Hasher.

virtual unsigned int hashLength ( ) const
inlinevirtual

Return the length of the raw binary digest

Returns
Length of the digest in octets

Implements Hasher.

SHA256& operator= ( const SHA256 original)

Assignment operator.

virtual const unsigned char* rawDigest ( )
virtual

Returns a pointer to the raw 32-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

Implements Hasher.

static unsigned int rawLength ( )
inlinestatic

Return the length of the raw binary digest

Returns
Constant value of 32
bool updateInternal ( const void *  buf,
unsigned int  len 
)
protectedvirtual

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

Implements Hasher.


The documentation for this class was generated from the following file: