EpcTools
An event based multi-threaded C++ development framework.
Classes | Static Public Member Functions | List of all members
ESipHash24 Class Reference

Calculates a 32-bit, 64-bit or 128-bit hash value using the SipHash algorithm. More...

#include <ehash.h>

Classes

class  Key
 Represents a key to be used when calculating a hash value. More...
 

Static Public Member Functions

static KeysetKey (const Key &k)
 Assigns a new default key value. More...
 
static KeysetKey (cpUChar val, const size_t len)
 Assigns a new default key value. More...
 
static const Keykey ()
 Retrieves the default key. More...
 
static ULong getHash32 (EString &str, const Key &key=key_)
 Returns the 32-bit hash associated with the string. More...
 
static ULong getHash32 (cpChar val, const size_t len, const Key &key=key_)
 Returns the 32-bit hash associated with the character buffer. More...
 
static ULong getHash32 (cpUChar in, const size_t inlen, const Key &key=key_)
 Returns the 32-bit hash associated with the unsigned character buffer. More...
 
static Bool getHash32 (cpUChar in, const size_t inlen, pUChar out, const size_t outlen, const Key &key=key_)
 Calculates the 32-bit hash associated with the unsigned character buffer. More...
 
static ULongLong getHash64 (EString &str, const Key &key=key_)
 Returns the 64-bit hash associated with the string. More...
 
static ULongLong getHash64 (cpChar val, const size_t len, const Key &key=key_)
 Returns the 64-bit hash associated with the character buffer. More...
 
static ULongLong getHash64 (cpUChar in, const size_t inlen, const Key &key=key_)
 Returns the 64-bit hash associated with the unsigned character buffer. More...
 
static Bool getHash64 (cpUChar in, size_t inlen, pUChar out, const size_t outlen, const Key &key=key_)
 Calculates the 64-bit hash associated with the unsigned character buffer. More...
 
static Bool getHash128 (EString &str, pUChar out, const size_t outlen, const Key &key=key_)
 Calculates the 128-bit hash associated with the string. More...
 
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. More...
 
static Bool getHash128 (cpUChar in, size_t inlen, pUChar out, const size_t outlen, const Key &key=key_)
 Calculates the 128-bit hash associated with the unsigned character buffer. More...
 

Detailed Description

Calculates a 32-bit, 64-bit or 128-bit hash value using the SipHash algorithm.

Member Function Documentation

◆ getHash128() [1/3]

static Bool ESipHash24::getHash128 ( cpChar  val,
size_t  len,
pUChar  out,
const size_t  outlen,
const Key key = key_ 
)
inlinestatic

Calculates the 128-bit hash associated with the character buffer.

Parameters
valThe character buffer to calculate the hash for.
lenThe length of the unsigned character buffer.
outThe output buffer for the resulting hash.
outlenThe length of the output buffer.
keyThe key to be used to calculate the hash.
Returns
True

◆ getHash128() [2/3]

Bool ESipHash24::getHash128 ( cpUChar  in,
size_t  inlen,
pUChar  out,
const size_t  outlen,
const Key key = key_ 
)
static

Calculates the 128-bit hash associated with the unsigned character buffer.

Parameters
inThe unsigned character buffer to calculate the hash for.
inlenThe length of the unsigned character buffer.
outThe output buffer for the resulting hash.
outlenThe length of the output buffer.
keyThe key to be used to calculate the hash.
Returns
True

◆ getHash128() [3/3]

static Bool ESipHash24::getHash128 ( EString str,
pUChar  out,
const size_t  outlen,
const Key key = key_ 
)
inlinestatic

Calculates the 128-bit hash associated with the string.

Parameters
strThe string to calculate the hash for.
outThe output buffer for the resulting hash.
outlenThe length of the output buffer.
keyThe key to be used to calculate the hash.
Returns
True

◆ getHash32() [1/4]

static ULong ESipHash24::getHash32 ( cpChar  val,
const size_t  len,
const Key key = key_ 
)
inlinestatic

Returns the 32-bit hash associated with the character buffer.

Parameters
valThe character buffer to calculate the hash for.
lenThe length of the character buffer.
keyThe key to be used to calculate the hash.
Returns
The 32-bit hash value.

◆ getHash32() [2/4]

ULong ESipHash24::getHash32 ( cpUChar  in,
const size_t  inlen,
const Key key = key_ 
)
static

Returns the 32-bit hash associated with the unsigned character buffer.

Parameters
inThe unsigned character buffer to calculate the hash for.
inlenThe length of the unsigned character buffer.
keyThe key to be used to calculate the hash.
Returns
The 32-bit hash value.

◆ getHash32() [3/4]

Bool ESipHash24::getHash32 ( cpUChar  in,
const size_t  inlen,
pUChar  out,
const size_t  outlen,
const Key key = key_ 
)
static

Calculates the 32-bit hash associated with the unsigned character buffer.

Parameters
inThe unsigned character buffer to calculate the hash for.
inlenThe length of the unsigned character buffer.
outThe output buffer for the resulting hash.
outlenThe length of the output buffer.
keyThe key to be used to calculate the hash.
Returns
True

◆ getHash32() [4/4]

static ULong ESipHash24::getHash32 ( EString str,
const Key key = key_ 
)
inlinestatic

Returns the 32-bit hash associated with the string.

Parameters
strThe string to calculate the hash for.
keyThe key to be used to calculate the hash.
Returns
The 32-bit hash value.

◆ getHash64() [1/4]

static ULongLong ESipHash24::getHash64 ( cpChar  val,
const size_t  len,
const Key key = key_ 
)
inlinestatic

Returns the 64-bit hash associated with the character buffer.

Parameters
valThe character buffer to calculate the hash for.
lenThe length of the character buffer.
keyThe key to be used to calculate the hash.
Returns
The 64-bit hash value.

◆ getHash64() [2/4]

ULongLong ESipHash24::getHash64 ( cpUChar  in,
const size_t  inlen,
const Key key = key_ 
)
static

Returns the 64-bit hash associated with the unsigned character buffer.

Parameters
inThe unsigned character buffer to calculate the hash for.
inlenThe length of the unsigned character buffer.
keyThe key to be used to calculate the hash.
Returns
The 64-bit hash value.

◆ getHash64() [3/4]

Bool ESipHash24::getHash64 ( cpUChar  in,
size_t  inlen,
pUChar  out,
const size_t  outlen,
const Key key = key_ 
)
static

Calculates the 64-bit hash associated with the unsigned character buffer.

Parameters
inThe unsigned character buffer to calculate the hash for.
inlenThe length of the unsigned character buffer.
outThe output buffer for the resulting hash.
outlenThe length of the output buffer.
keyThe key to be used to calculate the hash.
Returns
True

◆ getHash64() [4/4]

static ULongLong ESipHash24::getHash64 ( EString str,
const Key key = key_ 
)
inlinestatic

Returns the 64-bit hash associated with the string.

Parameters
strThe string to calculate the hash for.
keyThe key to be used to calculate the hash.
Returns
The 64-bit hash value.

◆ key()

static const Key& ESipHash24::key ( )
inlinestatic

Retrieves the default key.

Returns
Reference to the default key.

◆ setKey() [1/2]

static Key& ESipHash24::setKey ( const Key k)
inlinestatic

Assigns a new default key value.

Parameters
kthe new key value.
Returns
A reference to the new key value.

◆ setKey() [2/2]

static Key& ESipHash24::setKey ( cpUChar  val,
const size_t  len 
)
inlinestatic

Assigns a new default key value.

Parameters
valthe key data for the new key value.
lenthe length of the key data.
Returns
A reference to the new key value.

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