Last active
August 29, 2015 14:20
-
-
Save MattiasFestin/24f40129d2a7689b6b21 to your computer and use it in GitHub Desktop.
JavaScript ES6 non-secure hash function
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
let hash = (o) => { | |
return padLeft(uneval(o) | |
.split('') | |
.map((c) => c.charCodeAt(0)) | |
.reduce((x,y) => { | |
let v = ((y<<5)-y)+x; | |
return modPow(0xBCD1B799D, v && v, 0x7FFFFFFF); | |
}) | |
.toString(16) | |
.toUpperCase(),'0',9); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment