Hashes
This page details the hashing functions for blib.
MiniHash
The Blib MiniHash is not cryptographically secure, but is a fast way to evaluate two arbitrary values where small collision chances are possible. Ideally, this can be used when searching for a string against a known string hash.
Methods
void blibMiniHashInit(DWORD seed)
Required function to initialise the blibMiniHash function with a seed seed
.
DWORD blibMiniHash(PBYTE cstring)
This function is dangerous. It assumes that there is a C-styled string with a guard nullbyte.
This function returns a `DWORD` using the following function:DWORD blibMiniHash(PBYTE cstring){
int index = 0;
long returnValue = BLIB_MINIHASH_SEED;
while(cstring[index] != '\0' && cstring[index] != '\n'){
returnValue += (index * cstring[index]);
index++;
}
return returnValue;
}
This function should be used only to validate that two things are 'similar' where exactness is not required. There is a low memory cost to using this.
DWORD blibMiniHashString(String* stirng)
This function performs the blibMiniHash using the seeded value.