Skip to content

Instantly share code, notes, and snippets.

@nilsmartel
Created July 7, 2023 13:03
Show Gist options
  • Save nilsmartel/b18dca99537974dd5775ac27fa236f8b to your computer and use it in GitHub Desktop.
Save nilsmartel/b18dca99537974dd5775ac27fa236f8b to your computer and use it in GitHub Desktop.
Quick and insecure string hashing function in js
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