Public Types | Public Member Functions | Static Public Member Functions

base_crypto::CryptoChecksum Class Reference

An interface for checksum methods. More...

#include <libppbase/base_crypto/CryptoChecksum.h>

Inheritance diagram for base_crypto::CryptoChecksum:
base_crypto::CryptoChecksumMD5 base_crypto::CryptoChecksumRIPEMD160 base_crypto::CryptoChecksumSHA1

List of all members.

Public Types

enum  checksumMethod { checksumUndef = NID_undef, checksumMD5 = NID_md5, checksumRIPEMD160 = NID_ripemd160, checksumSHA1 = NID_sha1 }
 

The checksum methods (algorithms).

More...

Public Member Functions

virtual ~CryptoChecksum ()
 Destructor.
base::String final ()
 Finalizes the checksum.
virtual void final (unsigned char *buf)=0
 Finalizes the checksum.
virtual checksumMethod getMethodId () const =0
 Gets the ID of the checksum method.
virtual const char * getMethodName () const =0
 Gets the name of the checksum method.
virtual unsigned getSize () const =0
 Gets the size of the checksum in bytes.
virtual void init ()=0
 Starts calculating a new checksum.
virtual void update (const void *data, size_t len)=0
 Calculates the checksum incrementally.
void update (const base::String &data)
 Calculates the checksum incrementally.
void update1 (const base::String &data)
 Calculates the checksum incrementally.

Static Public Member Functions

static CryptoChecksumcreate (checksumMethod method)
 Creates a new checksum object.
static CryptoChecksumcreate (const char *name)
 Creates a new checksum object.
static checksumMethod getMethodByName (const char *name)
 Gets a checksum method by name.

Detailed Description

An interface for checksum methods.

Author:
Christoph Schwarz
Version:
$Id: CryptoChecksum.h 21 2010-09-05 04:18:17Z cschwarz1 $

Member Enumeration Documentation

The checksum methods (algorithms).

Enumerator:
checksumUndef 

unset algorithm

checksumMD5 

MD5 algorithm.

checksumRIPEMD160 

RIPEMD160 algorithm.

checksumSHA1 

SHA1 algorithm.


Member Function Documentation

static CryptoChecksum* base_crypto::CryptoChecksum::create ( checksumMethod  method  )  [static]

Creates a new checksum object.

Parameters:
method the method to use
Returns:
NULL if the method is unknown
static CryptoChecksum* base_crypto::CryptoChecksum::create ( const char *  name  )  [static]

Creates a new checksum object.

Parameters:
name the name of the method to use
Returns:
NULL if the method is unknown
virtual void base_crypto::CryptoChecksum::final ( unsigned char *  buf  )  [pure virtual]

Finalizes the checksum.

Parameters:
buf buffer that receives the checksum, must be at least getSize() bytes large
base::String base_crypto::CryptoChecksum::final (  ) 

Finalizes the checksum.

Returns:
the checksum
static checksumMethod base_crypto::CryptoChecksum::getMethodByName ( const char *  name  )  [static]

Gets a checksum method by name.

Parameters:
name the name of the method
Returns:
checksumUndef if the method is unknown, otherwise the method ID
virtual checksumMethod base_crypto::CryptoChecksum::getMethodId (  )  const [pure virtual]

Gets the ID of the checksum method.

Returns:
the ID
virtual const char* base_crypto::CryptoChecksum::getMethodName (  )  const [pure virtual]

Gets the name of the checksum method.

Returns:
the name
virtual unsigned base_crypto::CryptoChecksum::getSize (  )  const [pure virtual]

Gets the size of the checksum in bytes.

Returns:
size of the checksum in bytes
void base_crypto::CryptoChecksum::update ( const base::String data  ) 

Calculates the checksum incrementally.

Parameters:
data data to calculate the checksum over, excluding the terminating 0-byte
virtual void base_crypto::CryptoChecksum::update ( const void *  data,
size_t  len 
) [pure virtual]

Calculates the checksum incrementally.

Parameters:
data data to calculate the checksum over
len length of the data in bytes
void base_crypto::CryptoChecksum::update1 ( const base::String data  ) 

Calculates the checksum incrementally.

Parameters:
data data to calculate the checksum over, including the terminating 0-byte

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