Last active
April 2, 2016 14:11
-
-
Save copy/69e24bc8b9b75943c5f861f00db18507 to your computer and use it in GitHub Desktop.
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
| var FNV = {}; | |
| /** @const */ | |
| var FNV_PRIME = 16777619; | |
| /** @const */ | |
| var FNV_BASE = 2166136261; | |
| FNV.hashString = function(str) | |
| { | |
| var hash = FNV_BASE; | |
| for(var i = 0; i < str.length; i++) | |
| { | |
| hash ^= str.charCodeAt(i); | |
| hash = Math.imul(hash, FNV_PRIME); | |
| } | |
| return hash >>> 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment