Hash functions.
Include: | #include <dmsdk/dlib/hash.h> |
TYPES | |
---|---|
dmhash_t | dmhash_t type definition |
STRUCTS | |
---|---|
struct HashState32 | Hash state used for 32-bit incremental hashing |
struct HashState64 | Hash state used for 64-bit incremental hashing |
uint32_t dmHashBuffer32(const void* buffer, uint32_t buffer_len)
Calculate 32-bit hash value from buffer
PARAMETERS
const void* |
buffer |
Buffer |
uint32_t |
buffer_len |
Length of buffer |
RETURNS
uint32_t |
hash value |
uint64_t dmHashBuffer64(const void* buffer, uint32_t buffer_len)
calculate 64-bit hash value from buffer
PARAMETERS
const void* |
buffer |
Buffer |
uint32_t |
buffer_len |
Length of buffer |
RETURNS
uint64_t |
hash value |
uint32_t dmHashString32(const char* string)
Calculate 32-bit hash value from string
PARAMETERS
const char* |
string |
Null terminated string |
RETURNS
uint32_t |
hash value |
uint64_t dmHashString64(const char* string)
calculate 64-bit hash value from string
PARAMETERS
const char* |
string |
Null terminated string |
RETURNS
uint64_t |
hash value |
const char* dmHashReverseSafe64(uint64_t hash)
Returns the original string used to produce a hash.
Always returns a null terminated string. Returns " PARAMETERS RETURNS
Reverse hash lookup. Maps hash to original data. It is guaranteed that the returned
buffer is null-terminated. If the buffer contains a valid c-string
it can safely be used in printf and friends.
PARAMETERS RETURNS
Returns the original string used to produce a hash.
Always returns a null terminated string. Returns " PARAMETERS RETURNS
Reverse hash lookup. Maps hash to original data. It is guaranteed that the returned
buffer is null-terminated. If the buffer contains a valid c-string
it can safely be used in printf and friends.
PARAMETERS RETURNS
Initialize hash-state for 32-bit incremental hashing
PARAMETERS
Clone 32-bit incremental hash state
PARAMETERS
Incremental hashing
PARAMETERS
Finalize incremental hashing and release associated resources
PARAMETERS RETURNS
Release incremental hashing resources
Used to release assocciated resources for intermediate incremental hash states.
PARAMETERS
Initialize hash-state for 64-bit incremental hashing
PARAMETERS
Clone 64-bit incremental hash state
PARAMETERS
Incremental hashing
PARAMETERS
Finalize incremental hashing and release associated resources
PARAMETERS RETURNS
Release incremental hashing resources
Used to release assocciated resources for intermediate incremental hash states.
PARAMETERS
TYPE Hash state used for 32-bit incremental hashing
TYPEuint64_t
hash
hash value
const char*
Original string value or "
dmHashReverseSafe64
const char* dmHashReverseSafe64(uint64_t hash, uint32_t* length)
uint64_t
hash
hash to lookup uint32_t*
length
original data length. Optional argument and NULL-pointer is accepted.
const char*
pointer to buffer. 0 if no reverse exists or if reverse lookup is disabled
dmHashReverseSafe32
const char* dmHashReverseSafe32(uint32_t hash)
uint32_t
hash
hash value
const char*
Original string value or "
dmHashReverseSafe32
const char* dmHashReverseSafe32(uint32_t hash, uint32_t* length)
uint32_t
hash
hash to lookup uint32_t*
length
original data length. Optional argument and NULL-pointer is accepted.
const char*
pointer to buffer. 0 if no reverse exists or if reverse lookup is disabled
dmHashInit32
void dmHashInit32(HashState32* hash_state, bool reverse_hash)
HashState32*
hash_state
Hash state bool
reverse_hash
true to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH
dmHashClone32
void dmHashClone32(HashState32* hash_state, HashState32* source_hash_state, bool reverse_hash)
HashState32*
hash_state
Hash state HashState32*
source_hash_state
Source hash state bool
reverse_hash
true to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH. Ignored if source state reverse hashing is disabled.
dmHashUpdateBuffer32
void dmHashUpdateBuffer32(HashState32* hash_state, const void* buffer, uint32_t buffer_len)
HashState32*
hash_state
Hash state const void*
buffer
Buffer uint32_t
buffer_len
Length of buffer
dmHashFinal32
uint32_t dmHashFinal32(HashState32* hash_state)
HashState32*
hash_state
Hash state
uint32_t
the hash value
dmHashRelease32
void dmHashRelease32(HashState32* hash_state)
HashState32*
hash_state
Hash state
dmHashInit64
void dmHashInit64(HashState64* hash_state, reverse_hash)
HashState64*
hash_state
Hash state reverse_hash
true to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH
dmHashClone64
void dmHashClone64(HashState64* hash_state, HashState64* source_hash_state, reverse_hash)
HashState64*
hash_state
Hash state HashState64*
source_hash_state
Source hash state reverse_hash
true bool to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH. Ignored if source state reverse hashing is disabled.
dmHashUpdateBuffer64
void dmHashUpdateBuffer64(HashState64* hash_state, const void* buffer, uint32_t buffer_len)
HashState64*
hash_state
Hash state const void*
buffer
Buffer uint32_t
buffer_len
Length of buffer
dmHashFinal64
uint64_t dmHashFinal64(HashState64* hash_state)
HashState64*
hash_state
Hash state
uint64_t
The hash value
dmHashRelease64
void dmHashRelease64(HashState64* hash_state)
HashState64*
hash_state
Hash state Structs
HashState32
struct HashState32
HashState64
struct HashState64
Hash state used for 64-bit incremental hashing
typedef uint64_t dmhash_t