Hash functions.
typedef uint64_t dmhash_t
Calculate 32-bit hash value from buffer
buffer - Buffer
buffer_len - Length of buffer
hash - hash value
calculate 64-bit hash value from buffer
buffer - Buffer
buffer_len - Length of buffer
hash - hash value
Calculate 32-bit hash value from string
string - Null terminated string
hash - hash value
calculate 64-bit hash value from string
string - Null terminated string
hash - hash value
Returns the original string used to produce a hash.
Always returns a null terminated string. Returns "
hash - hash value
- Original string value or "
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.
hash - hash to lookup
length - original data length. Optional argument and NULL-pointer is accepted.
- pointer to buffer. 0 if no reverse exists or if reverse lookup is disabled
Returns the original string used to produce a hash.
Always returns a null terminated string. Returns "
hash - hash value
- Original string value or "
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.
hash - hash to lookup
length - original data length. Optional argument and NULL-pointer is accepted.
- pointer to buffer. 0 if no reverse exists or if reverse lookup is disabled
Hash state used for 32-bit incremental hashing
Hash state used for 64-bit incremental hashing
Initialize hash-state for 32-bit incremental hashing
hash_state - Hash state
reverse_hash - true to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH
Clone 32-bit incremental hash state
hash_state - Hash state
source_hash_state - Source hash state
reverse_hash - true to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH. Ignored if source state reverse hashing is disabled.
Incremental hashing
hash_state - Hash state
buffer - Buffer
buffer_len - Length of buffer
Finalize incremental hashing and release associated resources
hash_state - Hash state
hash - the hash value
Release incremental hashing resources Used to release assocciated resources for intermediate incremental hash states.
hash_state - Hash state
Initialize hash-state for 64-bit incremental hashing
hash_state - Hash state
reverse_hash - true to enable reverse hashing of buffers up to ::DMHASH_MAX_REVERSE_LENGTH
Clone 64-bit incremental hash state
hash_state - Hash state
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.
Incremental hashing
hash_state - Hash state
buffer - Buffer
buffer_len - Length of buffer
Finalize incremental hashing and release associated resources
hash_state - Hash state
hash - The hash value
Release incremental hashing resources Used to release assocciated resources for intermediate incremental hash states.
hash_state - Hash state
Allocate stack memory context for safely reversing hash values into strings
name - The name of the dmAllocator struct
size - The max size of the stack allocated context
Returns the original string used to produce a hash.
allocator - The reverse hash allocator
hash - hash value
- Original string value or "
Get the string representaiton of a hash value
DM_HASH_REVERSE_MEM(hash_ctx, 128);
const char* reverse = (const char*) dmHashReverseSafe64Alloc(&hash_ctx, hash);
Returns the original string used to produce a hash.
allocator - The reverse hash allocator
hash - hash value
- Original string value or "
Get the string representaiton of a hash value
DM_HASH_REVERSE_MEM(hash_ctx, 128);
const char* reverse = (const char*) dmHashReverseSafe32Alloc(&hash_ctx, hash);