ReplicaNet and RNLobby  1
Static Public Member Functions | List of all members
Checksum Class Reference

#include <CheckSum.h>

Static Public Member Functions

static int ChecksumData (const void *buffer, const size_t length)
 
static void ChecksumDataWithSlots (int *checksumSlots, const size_t numSlots, const void *buffer, const size_t length, const bool initialiseSlots=false, const bool initialiseSlotsWithLength=false)
 

Detailed Description

This class handles simple checking of data blocks

Member Function Documentation

static int ChecksumData ( const void *  buffer,
const size_t  length 
)
static

Performs a simple and quick checksum of a buffer

Parameters
bufferthe data buffer to checksum
thelength of the data buffer in bytes
Returns
the checksum for the data, the checksum returned is never 0
static void ChecksumDataWithSlots ( int *  checksumSlots,
const size_t  numSlots,
const void *  buffer,
const size_t  length,
const bool  initialiseSlots = false,
const bool  initialiseSlotsWithLength = false 
)
static

Performs a simple and quick checksum of a buffer using a certain chunk size to generate more than 32 bits of data.

Parameters
checksumSlotsThe checksum slots array. By default this is cumulative so make sure the array is initialised to a known state.
numSlotsThe number of checksumSlots supplied in the array.
bufferThe data buffer to checksum.
lengthThe length of the data buffer in bytes. When using the cumulative feature of this function the number of bytes must be a multiple of numSlots except for the last use of this function for a particular block of data. By default the checksumSlots are not initialised. Setting this to be true will initialise the checksumSlots. By default the length of the data is not used to seed the checksumSlots when calculating the checksum. If this is true then the length will be used to seed the checksumSlots and this will alter the result of any cumulative checksum.