TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::MD5Hash Class Reference

#include <Crypto.h>

Public Member Functions

 MD5Hash ()
 
 MD5Hash (class BinaryInput &b)
 
void rotateBytes ()
 
void rotateBytes (int n)
 
uint8operator[] (int i)
 
const uint8operator[] (int i) const
 
bool operator== (const MD5Hash &other) const
 
bool operator!= (const MD5Hash &other) const
 
void deserialize (class BinaryInput &b)
 
void serialize (class BinaryOutput &b) const
 

Static Public Member Functions

static size_t hashCode (const MD5Hash &key)
 

Private Attributes

uint8 value [16]
 

Detailed Description

Constructor & Destructor Documentation

G3D::MD5Hash::MD5Hash ( )
inline
29  {
30  for (int i = 0; i < 16; ++i) {
31  value[i] = 0;
32  }
33  }
uint8 value[16]
Definition: Crypto.h:25
G3D::MD5Hash::MD5Hash ( class BinaryInput b)
explicit
21  {
22  deserialize(b);
23 }
void deserialize(class BinaryInput &b)
Definition: Crypto_md5.cpp:26

+ Here is the call graph for this function:

Member Function Documentation

void G3D::MD5Hash::deserialize ( class BinaryInput b)
26  {
27  b.readBytes(value, 16);
28 }
uint8 value[16]
Definition: Crypto.h:25

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static size_t G3D::MD5Hash::hashCode ( const MD5Hash key)
inlinestatic
79  {
80  size_t h = 0;
81  for (int i = 0; i < 4; ++i) {
82  const int x = i * 4;
83  h ^= (((uint32)key.value[x + 0]) << 24) |
84  (((uint32)key.value[x + 1]) << 16) |
85  (((uint32)key.value[x + 2]) << 8) |
86  ((uint32)key.value[x + 3]);
87  }
88  return h;
89  }
uint32_t uint32
Definition: Define.h:150
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
bool G3D::MD5Hash::operator!= ( const MD5Hash other) const
inline
71  {
72  return !(*this == other);
73  }
bool G3D::MD5Hash::operator== ( const MD5Hash other) const
inline
63  {
64  bool match = true;
65  for (int i = 0; i < 16; ++i) {
66  match = match && (other.value[i] == value[i]);
67  }
68  return match;
69  }
uint8 value[16]
Definition: Crypto.h:25
uint8& G3D::MD5Hash::operator[] ( int  i)
inline
55  {
56  return value[i];
57  }
uint8 value[16]
Definition: Crypto.h:25
const uint8& G3D::MD5Hash::operator[] ( int  i) const
inline
59  {
60  return value[i];
61  }
uint8 value[16]
Definition: Crypto.h:25
void G3D::MD5Hash::rotateBytes ( )
inline

Rotates the bytes once

38  {
39  uint8 temp = value[0];
40  for (int i = 0; i < 15; ++i) {
41  value[i] = value[i + 1];
42  }
43  value[15] = temp;
44  }
uint8 value[16]
Definition: Crypto.h:25
uint8_t uint8
Definition: Define.h:152
void G3D::MD5Hash::rotateBytes ( int  n)
inline

Rotates by n bytes

47  {
48  uint8 temp[16];
49  System::memcpy(temp, value, 16);
50  for (int i = 0; i < 16; ++i) {
51  value[i] = value[(i + n) & 15];
52  }
53  }
uint8 value[16]
Definition: Crypto.h:25
static void memcpy(void *dst, const void *src, size_t numBytes)
Definition: System.cpp:643
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

void G3D::MD5Hash::serialize ( class BinaryOutput b) const
31  {
32  b.writeBytes(value, 16);
33 }
uint8 value[16]
Definition: Crypto.h:25

+ Here is the call graph for this function:

Member Data Documentation

uint8 G3D::MD5Hash::value[16]
private

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