Public Member Functions | Static Public Member Functions | Static Protected Member Functions

CHash Class Reference

Detailed Description

Collection of Hashing Functions.

This class implements a number of hashing functions like crc32, md5 and murmur.

Definition at line 55 of file Hash.h.

Inheritance diagram for CHash:
Inheritance graph

List of all members.

Public Member Functions

 CHash ()
virtual ~CHash ()
virtual const char * get_name () const

Static Public Member Functions

static uint32_t crc32 (uint8_t *data, int32_t len)
static void MD5 (unsigned char *x, unsigned l, unsigned char *buf)
static uint32_t MurmurHash2 (uint8_t *data, int32_t len, uint32_t seed)
static uint32_t IncrementalMurmurHash2 (uint8_t data, uint32_t h)

Static Protected Member Functions

static void MD5Init (struct MD5Context *context)
static void MD5Update (struct MD5Context *context, unsigned char const *buf, unsigned len)
static void MD5Final (unsigned char digest[16], struct MD5Context *context)
static void MD5Transform (uint32_t buf[4], uint32_t const in[16])

Constructor & Destructor Documentation

CHash (  ) 

default constructor

Definition at line 59 of file Hash.h.

virtual ~CHash (  )  [virtual]

default destructor

Definition at line 61 of file Hash.h.

Member Function Documentation

uint32_t crc32 ( uint8_t *  data,
int32_t  len 
) [static]

crc32 checksumming

data data to checksum
len length in number of bytes

Definition at line 46 of file Hash.cpp.

virtual const char* get_name ( void   )  const [virtual]
object name

Implements CSGObject.

Definition at line 99 of file Hash.h.

uint32_t IncrementalMurmurHash2 ( uint8_t  data,
uint32_t  h 
) [static]

Incremental Murmur like Hash

data byte to hash
h initial seed / hash on subsequent calls

Definition at line 423 of file Hash.cpp.

void MD5 ( unsigned char *  x,
unsigned  l,
unsigned char *  buf 
) [static]

Wrapper for MD5 function compatible to OpenSSL interface.

x data
l length
buf buf needs to provide an allocated array of 16 bytes for the digest.

Definition at line 73 of file Hash.cpp.

void MD5Final ( unsigned char  digest[16],
struct MD5Context *  context 
) [static, protected]

Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first)

digest the 64 byte hash
context initialized MD5Context

Definition at line 160 of file Hash.cpp.

void MD5Init ( struct MD5Context *  context  )  [static, protected]

Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants.

context MD5Context

Definition at line 104 of file Hash.cpp.

void MD5Transform ( uint32_t  buf[4],
uint32_t const   in[16] 
) [static, protected]

The core of the MD5 algorithm, this alters an existing MD5 hash to reflect the addition of 16 longwords of new data. MD5Update blocks the data and converts bytes into longwords for this routine.

buf 16 byte
in 64 bytes

Definition at line 220 of file Hash.cpp.

void MD5Update ( struct MD5Context *  context,
unsigned char const *  buf,
unsigned  len 
) [static, protected]

Update context to reflect the concatenation of another buffer full of bytes.

context initialized MD5Context
buf buffer to hash
len length of buffer

Definition at line 115 of file Hash.cpp.

uint32_t MurmurHash2 ( uint8_t *  data,
int32_t  len,
uint32_t  seed 
) [static]

Murmur Hash2

data data to checksum (needs to be 32bit aligned on some archs)
len length in number of bytes
seed initial seed

Definition at line 374 of file Hash.cpp.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation