SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | 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
[legend]

Public Member Functions

 CHash ()
virtual ~CHash ()
virtual const char * get_name () const
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

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 uint32_t MurmurHashString (substring s, 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])

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

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

Parameters
datadata to checksum
lenlength in number of bytes

Definition at line 47 of file Hash.cpp.

virtual const char* get_name ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 111 of file Hash.h.

uint32_t IncrementalMurmurHash2 ( uint8_t  data,
uint32_t  h 
)
static

Incremental Murmur like Hash

Parameters
databyte to hash
hinitial seed / hash on subsequent calls
Returns
hash

Definition at line 424 of file Hash.cpp.

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

Wrapper for MD5 function compatible to OpenSSL interface.

Parameters
xdata
llength
bufbuf needs to provide an allocated array of 16 bytes for the digest.

Definition at line 74 of file Hash.cpp.

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

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

Parameters
digestthe 64 byte hash
contextinitialized MD5Context

Definition at line 161 of file Hash.cpp.

void MD5Init ( struct MD5Context *  context)
staticprotected

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

Parameters
contextMD5Context

Definition at line 105 of file Hash.cpp.

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

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.

Parameters
buf16 byte
in64 bytes

Definition at line 221 of file Hash.cpp.

void MD5Update ( struct MD5Context *  context,
unsigned char const *  buf,
unsigned  len 
)
staticprotected

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

Parameters
contextinitialized MD5Context
bufbuffer to hash
lenlength of buffer

Definition at line 116 of file Hash.cpp.

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

Murmur Hash2

Parameters
datadata to checksum (needs to be 32bit aligned on some archs)
lenlength in number of bytes
seedinitial seed
Returns
hash

Definition at line 375 of file Hash.cpp.

uint32_t MurmurHashString ( substring  s,
uint32_t  h 
)
static

Apply Murmur Hash on the non-numeric part of a substring.

The integral part is returned as-is.

Parameters
ssubstring
hinitial seed
Returns
hash

Definition at line 444 of file Hash.cpp.


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

SHOGUN Machine Learning Toolbox - Documentation