Created
February 26, 2013 15:48
-
-
Save yocontra/5039487 to your computer and use it in GitHub Desktop.
djb2 hashing in julia
This file contains hidden or 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
function djb2(s) | |
r = 5381 | |
for i in s | |
c = int(i) | |
r = r + (r << 5) + c | |
end | |
return r | |
end | |
println(djb2("test")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment