EpcTools
An event based multi-threaded C++ development framework.
|
Go to the documentation of this file.
18 #ifndef __ehash_h_included
19 #define __ehash_h_included
40 static ULong
getHash(cpChar val, ULong len);
45 static ULong
getHash(cpUChar val, ULong len);
48 static ULong m_crcTable[256];
82 operator cpUChar()
const {
return data_; }
85 cpUChar
data()
const {
return data_; }
94 for (; i<min(len,
sizeof(data_)); i++)
96 for( ; i <
sizeof(data_); i++)
123 return getHash32(reinterpret_cast<cpUChar>(str.c_str()), str.length(),
key);
132 return getHash32(reinterpret_cast<cpUChar>(val), len,
key);
139 static ULong
getHash32(cpUChar in,
const size_t inlen,
const Key &
key=key_);
147 static Bool
getHash32(cpUChar in,
const size_t inlen, pUChar out,
const size_t outlen,
const Key &
key=key_);
155 return getHash64(reinterpret_cast<cpUChar>(str.c_str()), str.length(),
key);
164 return getHash64(reinterpret_cast<cpUChar>(val), len,
key);
171 static ULongLong
getHash64(cpUChar in,
const size_t inlen,
const Key &
key=key_);
179 static Bool
getHash64(cpUChar in,
size_t inlen, pUChar out,
const size_t outlen,
const Key &
key=key_);
189 return getHash128(reinterpret_cast<cpUChar>(str.c_str()), str.length(), out, outlen,
key);
198 static Bool
getHash128(cpChar val,
size_t len, pUChar out,
const size_t outlen,
const Key &
key=key_)
200 return getHash128(reinterpret_cast<cpUChar>(val), len, out, outlen,
key);
209 static Bool
getHash128(cpUChar in,
size_t inlen, pUChar out,
const size_t outlen,
const Key &
key=key_);
212 static Bool getFullHash(cpUChar in,
size_t inlen, cpUChar k, pUChar out,
const size_t outlen);
213 static Bool getHalfHash(cpUChar in,
size_t inlen, cpUChar k, pUChar out,
const size_t outlen);
218 #endif // #define __ehash_h_included
static Key & setKey(cpUChar val, const size_t len)
Assigns a new default key value.
Definition: ehash.h:112
Defines base class for exceptions and declaration helper macros.
static ULong getHash32(cpChar val, const size_t len, const Key &key=key_)
Returns the 32-bit hash associated with the character buffer.
Definition: ehash.h:130
Key & assign(cpUChar k, const size_t len)
Assigns a new key value.
Definition: ehash.h:91
Macros for various standard C library functions and standard includes.
static Key & setKey(const Key &k)
Assigns a new default key value.
Definition: ehash.h:107
static Bool getHash128(EString &str, pUChar out, const size_t outlen, const Key &key=key_)
Calculates the 128-bit hash associated with the string.
Definition: ehash.h:187
Key(const Key &k)
Copy constructor.
Definition: ehash.h:74
static ULongLong getHash64(cpChar val, const size_t len, const Key &key=key_)
Returns the 64-bit hash associated with the character buffer.
Definition: ehash.h:162
static ULongLong getHash64(EString &str, const Key &key=key_)
Returns the 64-bit hash associated with the string.
Definition: ehash.h:153
static ULong getHash(EString &str)
Returns the 32-bit hash value for the specified string.
Definition: ehash.cpp:24
static ULong getHash32(EString &str, const Key &key=key_)
Returns the 32-bit hash associated with the string.
Definition: ehash.h:121
static const Key & key()
Retrieves the default key.
Definition: ehash.h:115
Key()
Class constructor.
Definition: ehash.h:71
Key(cpUChar k, const size_t len)
Class constructor.
Definition: ehash.h:78
String class.
Definition: estring.h:30
Represents a key to be used when calculating a hash value.
Definition: ehash.h:67
cpUChar data() const
Data extractor.
Definition: ehash.h:85
Calcuates a 32-bit hash value for the specified string or array of characters.
Definition: ehash.h:29
Encapsulates and extends a std::string object.
DECLARE_ERROR(ESipHash24Error_InvalidKeyLength)
Calculates a 32-bit, 64-bit or 128-bit hash value using the SipHash algorithm.
Definition: ehash.h:63
static Bool getHash128(cpChar val, size_t len, pUChar out, const size_t outlen, const Key &key=key_)
Calculates the 128-bit hash associated with the character buffer.
Definition: ehash.h:198