code_junkie

Visual basic 6.0 hash function

Nov 12th, 2011
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. static unsigned long
  2. sdbm(str)
  3. unsigned char *str;
  4. {
  5. unsigned long hash = 0;
  6. int c;
  7.  
  8. while (c = *str++)
  9. hash = c + (hash << 6) + (hash << 16) - hash;
  10.  
  11. return hash;
  12. }
  13.  
  14. newHash = the character (c) + (previousHashValue * 2^6) +
  15. (previousHashValue * 2^16) -
  16. previousHashValue**
  17. previousHashValue = newHash
Add Comment
Please, Sign In to add comment