Created
November 6, 2019 09:17
-
-
Save supahfunk/5a941e19e6329ab4f47b12e9ec8b1dd8 to your computer and use it in GitHub Desktop.
Hash
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
const hash = value => { | |
let hashed = 0; | |
for (let i = 0; i < value.length; i += 1) { | |
hashed = (hashed << 5) - hashed + value.charCodeAt(i); | |
hashed |= 0; | |
} | |
return `${hashed}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment