DEK Hash
DEK is a hash function algorithm.
/*****Please include following header files*****/
// string
/***********************************************/
/*****Please use following namespaces*****/
// std
/*****************************************/
static unsigned int DEKHash(string str) {
unsigned int len = str.length();
unsigned int hash = len;
unsigned int i = 0;
for (i = 0; i < len; i++)
{
hash = ((hash << 5) ^ (hash >> 27)) ^ (str[i]);
}
return hash;
}
Example
string data = "jdfgsdhfsdfsd 6445dsfsd7fg/*/+bfjsdgf%$^";
unsigned int value = DEKHash(data);
Output
3354994598