VMime
sha1MessageDigest Class Reference
Inheritance diagram for sha1MessageDigest:
Collaboration diagram for sha1MessageDigest:

Public Member Functions

 sha1MessageDigest ()
 
void update (const byte_t b)
 
void update (const string &s)
 
void update (const byte_t *buffer, const size_t len)
 
void update (const byte_t *buffer, const size_t offset, const size_t len)
 
void finalize ()
 
void finalize (const string &s)
 
void finalize (const byte_t *buffer, const size_t len)
 
void finalize (const byte_t *buffer, const size_t offset, const size_t len)
 
size_t getDigestLength () const
 
const byte_tgetDigest () const
 
void reset ()
 
- Public Member Functions inherited from messageDigest
virtual const string getHexDigest () const
 

Protected Member Functions

void init ()
 
- Protected Member Functions inherited from object
 object ()
 
 object (const object &)
 
objectoperator= (const object &)
 
virtual ~object ()
 

Static Protected Member Functions

static void transform (unsigned int state[5], const byte_t buffer[64])
 

Protected Attributes

unsigned int m_state [5]
 
unsigned int m_count [2]
 
byte_t m_buffer [64]
 
byte_t m_digest [20]
 

Constructor & Destructor Documentation

Member Function Documentation

void finalize ( )
virtual

Completes the hash computation by performing final operations such as padding.

Implements messageDigest.

References sha1MessageDigest::m_buffer, sha1MessageDigest::m_count, sha1MessageDigest::m_digest, sha1MessageDigest::m_state, and sha1MessageDigest::update().

Referenced by sha1MessageDigest::finalize().

void finalize ( const string s)
virtual

Completes the hash computation by performing final operations such as padding.

This is equivalent to calling update() and then finalize().

Implements messageDigest.

References sha1MessageDigest::finalize().

void finalize ( const byte_t buffer,
const size_t  len 
)
virtual

Completes the hash computation by performing final operations such as padding.

This is equivalent to calling update() and then finalize().

Implements messageDigest.

References sha1MessageDigest::finalize(), and sha1MessageDigest::update().

void finalize ( const byte_t buffer,
const size_t  offset,
const size_t  len 
)
virtual

Completes the hash computation by performing final operations such as padding.

This is equivalent to calling update() and then finalize().

Implements messageDigest.

References sha1MessageDigest::finalize().

const byte_t * getDigest ( ) const
virtual

Returns the hash, as computed by the algorithm.

You must call finalize() before using this function, or the hash will not be correct. To get the size of the returned array, call getDigestLength().

Returns
computed hash

Implements messageDigest.

References sha1MessageDigest::m_digest.

size_t getDigestLength ( ) const
virtual

Returns the length of the hash.

This is the length of the array returned by getDigest().

Returns
length of computed hash

Implements messageDigest.

void reset ( )
virtual

Resets the algorithm to its initial state, so that you can compute a new hash using the same object.

Implements messageDigest.

References sha1MessageDigest::init().

void transform ( unsigned int  state[5],
const byte_t  buffer[64] 
)
staticprotected

Hash a single 512-bit block.

This is the core of the algorithm.

References R0, R1, R2, R3, and R4.

Referenced by sha1MessageDigest::update().

void update ( const byte_t  b)
virtual

Updates the digest using the specified byte.

Parameters
bthe byte with which to update the digest.

Implements messageDigest.

Referenced by sha1MessageDigest::finalize(), and sha1MessageDigest::update().

void update ( const string s)
virtual

Updates the digest using the specified string.

Parameters
sthe string with which to update the digest.

Implements messageDigest.

References sha1MessageDigest::update().

void update ( const byte_t buffer,
const size_t  len 
)
virtual

Updates the digest using the specified array of bytes.

Parameters
bufferarray of bytes
lennumber of bytes to use in the buffer

Implements messageDigest.

References sha1MessageDigest::m_buffer, sha1MessageDigest::m_count, sha1MessageDigest::m_state, and sha1MessageDigest::transform().

void update ( const byte_t buffer,
const size_t  offset,
const size_t  len 
)
virtual

Updates the digest using the specified array of bytes, starting at the specified offset.

Parameters
bufferarray of bytes
offsetoffset to start from in the array of bytes
lennumber of bytes to use, starting at offset

Implements messageDigest.

References sha1MessageDigest::update().

Member Data Documentation

byte_t m_buffer[64]
protected
unsigned int m_count[2]
protected
byte_t m_digest[20]
protected
unsigned int m_state[5]
protected

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