C++ bindings for cgul_rolling_hash
More...
#include <cgul_rolling_hash_cxx.h>
Static Public Member Functions | |
static cgul_uint32_t | hash (const char *block, size_t block_length) |
static cgul_uint32_t | roll (cgul_uint32_t hv, const char c_old, const char c_new, size_t block_length) |
This class provides the C++ bindings for cgul_rolling_hash
. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_rolling_hash
into C++-style function calls and exception handling.
|
inlinestatic |
This function calculates the hash value for length
bytes in the block block
. The main purpose of this function is to generate the initial hash value that can then be passed into roll()
, but it can also be used as a stand-alone hash function.
[in] | block | block of binary data |
[in] | block_length | length of block in bytes |
References cgul_rolling_hash__hash().
|
inlinestatic |
Peform a rolling hash calculation on the hash value hv
by surgically removing the part of the hash value associated with the old character c_old
that is being removed and adding the part of the hash value associated with the new character c_new
that is being added. The initial value for hv
should be obtained by calling hash()
. The value for block_length
should be same as what originally was passed into hash()
.
[in] | hv | old hash value |
[in] | c_old | old character |
[in] | c_new | new character |
[in] | block_length | length of the block in bytes |
References cgul_rolling_hash__roll().