mirror of
https://git.stillkill.net/MinecraftLeak/Mc-cpp-Snapshot.git
synced 2026-10-24 05:52:20 +01:00
Initial commit
This commit is contained in:
commit
a9c1b8fcb6
2100 files changed
+610164
No files matched your search
@@ -0,0 +1,53 @@
|
||||
///
|
||||
/// \file CheckSum.cpp
|
||||
/// \brief [Internal] CheckSum implementation from http://www.flounder.com/checksum.htm
|
||||
///
|
||||
|
||||
#ifndef __CHECKSUM_H
|
||||
#define __CHECKSUM_H
|
||||
|
||||
#include "RakMemoryOverride.h"
|
||||
|
||||
/// Generates and validates checksums
|
||||
class CheckSum
|
||||
{
|
||||
|
||||
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