Sdk hash api documentation

Hash functions.

Include: #include <dmsdk/dlib/hash.h>
FUNCTIONS
uint64_t dmHashBuffer64(const void* buffer, uint32_t buffer_len) calculate 64-bit hash value from buffer
uint64_t dmHashString64(const char* string) calculate 64-bit hash value from string
const char* dmHashReverseSafe64(uint64_t hash) get string value from hash
const char* dmHashReverseSafe64(uint64_t hash, uint32_t* length) get string value from hash

Functions

dmHashBuffer64

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

dmHashString64

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

dmHashReverseSafe64

const char* dmHashReverseSafe64(uint64_t hash)

Returns the original string used to produce a hash. Always returns a null terminated string. Returns "" if the original string wasn't found.

PARAMETERS

uint64_t hash hash value

RETURNS

const char* Original string value

dmHashReverseSafe64

const char* dmHashReverseSafe64(uint64_t hash, uint32_t* length)

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

uint64_t hash hash to lookup
uint32_t* length original data length. Optional argument and NULL-pointer is accepted.

RETURNS

const char* pointer to buffer. 0 if no reverse exists or if reverse lookup is disabled