mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-09 00:48:04 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
54
thirdparty/raknet/Source/CheckSum.h
vendored
Normal file
54
thirdparty/raknet/Source/CheckSum.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/// \file
|
||||
/// \brief \b [Internal] Generates and validates checksums
|
||||
///
|
||||
/// \note I didn't write this, but took it from http://www.flounder.com/checksum.htm
|
||||
///
|
||||
|
||||
#ifndef __CHECKSUM_H
|
||||
#define __CHECKSUM_H
|
||||
|
||||
#include "RakMemoryOverride.h"
|
||||
|
||||
/// Generates and validates checksums
|
||||
class CheckSum : public RakNet::RakMemoryOverride
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Default constructor
|
||||
|
||||
CheckSum()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
sum = 0;
|
||||
r = 55665;
|
||||
c1 = 52845;
|
||||
c2 = 22719;
|
||||
}
|
||||
|
||||
void Add ( unsigned int w );
|
||||
|
||||
|
||||
void Add ( unsigned short w );
|
||||
|
||||
void Add ( unsigned char* b, unsigned int length );
|
||||
|
||||
void Add ( unsigned char b );
|
||||
|
||||
unsigned int Get ()
|
||||
{
|
||||
return sum;
|
||||
}
|
||||
|
||||
protected:
|
||||
unsigned short r;
|
||||
unsigned short c1;
|
||||
unsigned short c2;
|
||||
unsigned int sum;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user