Interface for checksum manipulations. More...
#include <CheckSum.h>
Public Member Functions | |
CheckSum (void) | |
virtual void | start (void)=0 |
virtual void | add (void *buf, unsigned long long int len)=0 |
virtual void | end (void)=0 |
virtual void | result (unsigned char *&res, unsigned int &len) const =0 |
virtual int | print (char *buf, int len) const |
virtual void | scan (const char *buf)=0 |
virtual | operator bool (void) const |
virtual bool | operator! (void) const |
Interface for checksum manipulations.
This class is an interface and is extended in the specialized classes CRC32Sum, MD5Sum and Adler32Sum. The interface is among others used during data transfers through DataBuffer class
virtual void Arc::CheckSum::add | ( | void * | buf, | |
unsigned long long int | len | |||
) | [pure virtual] |
Add data to be checksummed.
This method calculates the checksum of the passed data chuck, taking into account the previous state of this object.
buf | pointer to data chuck to be checksummed. | |
len | size of the data chuck. |
Implemented in Arc::CRC32Sum, Arc::MD5Sum, Arc::Adler32Sum, and Arc::CheckSumAny.
Referenced by Arc::CheckSumAny::add().
virtual void Arc::CheckSum::end | ( | void | ) | [pure virtual] |
Finalize the checksumming.
This method finalizes the checksum algorithm, that is calculating the final checksum result.
Implemented in Arc::CRC32Sum, Arc::MD5Sum, Arc::Adler32Sum, and Arc::CheckSumAny.
Referenced by Arc::CheckSumAny::end().
virtual int Arc::CheckSum::print | ( | char * | buf, | |
int | len | |||
) | const [inline, virtual] |
Retrieve result of checksum into a string.
The passed string buf is filled with result of checksum algorithm in base 16. At most len chacters is filled into buffer buf. The hexadecimal value is prepended with "<algorithm>:", where <algorithm> is one of "cksum", "md5" or "adler32" respectively corresponding to the result from the CRC32Sum, MD5Sum and Adler32 classes.
buf | pointer to buffer which should be filled with checksum result. | |
len | max number of character filled into buffer. |
Reimplemented in Arc::CRC32Sum, Arc::MD5Sum, Arc::Adler32Sum, and Arc::CheckSumAny.
Referenced by Arc::CheckSumAny::print().
virtual void Arc::CheckSum::scan | ( | const char * | buf | ) | [pure virtual] |
Set internal checksum state.
This method sets the internal state to that of the passed textural representation. The format passed to this method must be the same as retrieved from the CheckSum::print method.
buf | string containing textural representation of checksum |
Implemented in Arc::CRC32Sum, Arc::MD5Sum, Arc::Adler32Sum, and Arc::CheckSumAny.
Referenced by Arc::CheckSumAny::scan().
virtual void Arc::CheckSum::start | ( | void | ) | [pure virtual] |
Initiate the checksum algorithm.
This method must be called before starting a new checksum calculation.
Implemented in Arc::CRC32Sum, Arc::MD5Sum, Arc::Adler32Sum, and Arc::CheckSumAny.
Referenced by Arc::CheckSumAny::start().