Created
December 7, 2019 03:01
-
-
Save diogodanielsoaresferreira/5954d0ffeb00571a6b88cbca90a72753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _hash_djb2(self, s): | |
hash = 5381 | |
for x in s: | |
hash = ((hash << 5) + hash) + ord(x) | |
return hash % self.size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment