Our FREE site is mostly funded by the Amazon ads ⇓below⇓.
Support us by clicking ⇑above⇑ next time you plan to buy a product on Amazon.
% sdbm: implements the sdbm-hash algorithm
% argument: str of type string
% returns: double
function ans = sdbm(str)
hash = 0;
for ch = str
hash = double(ch) + bitshift(hash,6) + bitshift(hash,16) - hash;
ans = hash;