Created
July 7, 2023 13:03
-
-
Save nilsmartel/b18dca99537974dd5775ac27fa236f8b to your computer and use it in GitHub Desktop.
Quick and insecure string hashing function in js
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
export const quickhash = (n) => [...n].map(s => s.charCodeAt(0)).reduce((a, b) => ((a << 3) ^ b) & ((1 << 31) - 1), 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment