ARC SDK
Public Member Functions
Arc::CRC32Sum Class Reference

Implementation of CRC32 checksum. More...

#include <arc/CheckSum.h>

Inheritance diagram for Arc::CRC32Sum:
Arc::CheckSum

Public Member Functions

virtual void start (void)
 Initiate the checksum algorithm. More...
 
virtual void add (void *buf, unsigned long long int len)
 Add data to be checksummed. More...
 
virtual void end (void)
 Finalize the checksumming. More...
 
virtual void result (unsigned char *&res, unsigned int &len) const
 Retrieve result of checksum as binary blob. More...
 
virtual int print (char *buf, int len) const
 Retrieve result of checksum into a string. More...
 
virtual void scan (const char *buf)
 Set internal checksum state. More...
 
virtual operator bool (void) const
 Indicates whether the checksum has been calculated. More...
 
virtual bool operator! (void) const
 Indicates whether the checksum has not been calculated. More...
 
uint32_t crc (void) const
 
- Public Member Functions inherited from Arc::CheckSum
 CheckSum (void)
 Default constructor. More...
 

Detailed Description

Implementation of CRC32 checksum.

This class is a specialized class of the CheckSum class. It provides an implementation for the CRC-32 IEEE 802.3 standard.

Member Function Documentation

◆ add()

virtual void Arc::CRC32Sum::add ( void *  buf,
unsigned long long int  len 
)
virtual

Add data to be checksummed.

This method calculates the checksum of the passed data chunk, taking into account the previous state of this object.

Parameters
bufpointer to data chuck to be checksummed.
lensize of the data chuck.

Implements Arc::CheckSum.

◆ end()

virtual void Arc::CRC32Sum::end ( void  )
virtual

Finalize the checksumming.

This method finalizes the checksum algorithm, that is calculating the final checksum result.

Implements Arc::CheckSum.

◆ operator bool()

virtual Arc::CRC32Sum::operator bool ( void  ) const
inlinevirtual

Indicates whether the checksum has been calculated.

Reimplemented from Arc::CheckSum.

◆ operator!()

virtual bool Arc::CRC32Sum::operator! ( void  ) const
inlinevirtual

Indicates whether the checksum has not been calculated.

Reimplemented from Arc::CheckSum.

◆ print()

virtual int Arc::CRC32Sum::print ( char *  buf,
int  len 
) const
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 characters are 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.

Parameters
bufpointer to buffer which should be filled with checksum result.
lenmax number of character filled into buffer.
Returns
0 on success

Reimplemented from Arc::CheckSum.

◆ result()

virtual void Arc::CRC32Sum::result ( unsigned char *&  res,
unsigned int &  len 
) const
inlinevirtual

Retrieve result of checksum as binary blob.

Implements Arc::CheckSum.

◆ scan()

virtual void Arc::CRC32Sum::scan ( const char *  buf)
virtual

Set internal checksum state.

This method sets the internal state to that of the passed textual representation. The format passed to this method must be the same as retrieved from the CheckSum::print method.

Parameters
bufstring containing textual representation of checksum
See also
CheckSum::print

Implements Arc::CheckSum.

◆ start()

virtual void Arc::CRC32Sum::start ( void  )
virtual

Initiate the checksum algorithm.

This method must be called before starting a new checksum calculation.

Implements Arc::CheckSum.


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