PixelLightAPI  .
Public Member Functions | Protected Member Functions
PLCore::Checksum Class Reference

Abstract checksum ("digital fingerprint") base class. More...

#include <Checksum.h>

Inheritance diagram for PLCore::Checksum:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLCORE_API String Get (const uint8 *pnBuffer, uint32 nNumOfBytes)
 Returns the checksum of a given buffer.
PLCORE_API String Get (const String &sString)
 Returns the checksum of a given string.
PLCORE_API String Get (File &cFile)
 Returns the checksum of a given file.
PLCORE_API String GetFile (const String &sFilename)
 Returns the checksum of a given file.

Protected Member Functions

PLCORE_API Checksum ()
 Default constructor.
virtual PLCORE_API ~Checksum ()
 Destructor.
virtual void Update (const uint8 nInput[], uint32 nInputLen)=0
 Implementation of main checksum algorithm.
virtual String Final ()=0
 Implementation of main checksum algorithm; ends the checksum calculation.

Detailed Description

Abstract checksum ("digital fingerprint") base class.

Remarks:
Normally a checksum is used to detect errors after transmission or storage. Before transmission or storage of data, a checksum of the data is calculated and send/saved. Afterwards the received data is verified by using the checksum to confirm that no changes occurred on transit.
Note:
  • Each time a checksum is calculated, an instance of the class is created and destroyed at the end

Constructor & Destructor Documentation

PLCORE_API PLCore::Checksum::Checksum ( ) [protected]

Default constructor.

virtual PLCORE_API PLCore::Checksum::~Checksum ( ) [protected, virtual]

Destructor.


Member Function Documentation

PLCORE_API String PLCore::Checksum::Get ( const uint8 *  pnBuffer,
uint32  nNumOfBytes 
)

Returns the checksum of a given buffer.

Parameters:
[in]pnBufferBuffer to create the checksum from (MUST be valid!)
[in]nNumOfBytesNumber of bytes of the given buffer (MUST be valid!)
Returns:
The checksum of the given buffer, empty on error (maybe empty buffer?)
PLCORE_API String PLCore::Checksum::Get ( const String sString)

Returns the checksum of a given string.

Parameters:
[in]sStringString to create the checksum from, the original internal format is used - if it's a Unicode string, Unicode will be used to get the checksum
Returns:
The checksum of the given string, empty on error (maybe unknown class?)
Note:
  • sString: "My text" != L"My text" (ASCII != Unicode even if the text itself is the same!)
PLCORE_API String PLCore::Checksum::Get ( File cFile)

Returns the checksum of a given file.

Parameters:
[in]cFileFile to create the checksum from (MUST be opened and readable!)
Returns:
The checksum of the given file, empty string on error (maybe unknown class or the given file is invalid?)
Note:
  • The current file offset is not changed
PLCORE_API String PLCore::Checksum::GetFile ( const String sFilename)

Returns the checksum of a given file.

Parameters:
[in]sFilenameName of the file to create the checksum from
Returns:
The checksum of the given file, empty on error (maybe unknown class or invalid file?)
virtual void PLCore::Checksum::Update ( const uint8  nInput[],
uint32  nInputLen 
) [protected, pure virtual]

Implementation of main checksum algorithm.

Parameters:
[in]nInputInput block
[in]nInputLenLength of input block in bytes
Remarks:
Computes the partial checksum for 'nInputLen' bytes of data in 'Input'.
virtual String PLCore::Checksum::Final ( ) [protected, pure virtual]

Implementation of main checksum algorithm; ends the checksum calculation.

Returns:
The final hexadecimal checksum result (without the 0x prefix and with lower case hex characters)
Remarks:
Performs the final checksum calculation. 'Update' does most of the work, this function just finishes the calculation.

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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:28
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported