SHA1 Class Reference

A standard SHA1 digest calculator. More...

#include <yateclass.h>

List of all members.

Public Member Functions

 SHA1 ()
 SHA1 (const SHA1 &original)
 SHA1 (const void *buf, unsigned int len)
 SHA1 (const DataBlock &data)
 SHA1 (const String &str)
 ~SHA1 ()
SHA1operator= (const SHA1 &original)
void clear ()
void finalize ()
bool update (const void *buf, unsigned int len)
bool update (const DataBlock &data)
bool update (const String &str)
SHA1operator<< (const String &value)
SHA1operator<< (const DataBlock &data)
SHA1operator<< (const char *value)
const unsigned char * rawDigest ()
const StringhexDigest ()

Static Public Member Functions

static unsigned int rawLength ()


Detailed Description

A standard SHA1 digest calculator.

A class to compute and check SHA1 digests


Constructor & Destructor Documentation

SHA1 (  ) 

Construct a fresh initialized instance

SHA1 ( const SHA1 original  ) 

Copy constructor

Parameters:
original SHA1 instance to copy

SHA1 ( const void *  buf,
unsigned int  len 
)

Construct a digest from a buffer of data

Parameters:
buf Pointer to the data to be included in digest
len Length of data in the buffer

SHA1 ( const DataBlock data  ) 

Construct a digest from a binary DataBlock

Parameters:
data Binary data to be included in digest

SHA1 ( const String str  ) 

Construct a digest from a String

Parameters:
str String to be included in digest

~SHA1 (  ) 

Destroy the instance, free allocated memory


Member Function Documentation

SHA1& operator= ( const SHA1 original  ) 

Assignment operator.

void clear (  ) 

Clear the digest and prepare for reuse

void finalize (  ) 

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

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

Update the digest from a buffer of data

Parameters:
buf Pointer to the data to be included in digest
len Length of data in the buffer
Returns:
True if success, false if finalize() was already called

bool update ( const DataBlock data  )  [inline]

Update the digest from the content of a DataBlock

Parameters:
data Data to be included in digest
Returns:
True if success, false if finalize() was already called

References DataBlock::data(), and DataBlock::length().

bool update ( const String str  )  [inline]

Update the digest from the content of a String

Parameters:
str String to be included in digest
Returns:
True if success, false if finalize() was already called

References String::c_str(), and String::length().

SHA1& operator<< ( const String value  )  [inline]

SHA1 updating operator for Strings

SHA1& operator<< ( const DataBlock data  )  [inline]

SHA1 updating operator for DataBlocks

SHA1& operator<< ( const char *  value  ) 

SHA1 updating operator for C strings

const unsigned char* rawDigest (  ) 

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

static unsigned int rawLength (  )  [inline, static]

Return the length of the raw binary digest

Returns:
Constant value of 20

const String& 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


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

Generated on Sat May 28 18:28:23 2011 for Yate by  doxygen 1.5.6