GT2/Ejectable/node_modules/string-hash-64/index.js

16 lines
274 B
JavaScript
Raw Normal View History

2021-08-16 00:14:59 +00:00
function hash (str) {
var i = str.length
var hash1 = 5381
var hash2 = 52711
while (i--) {
const char = str.charCodeAt(i)
hash1 = (hash1 * 33) ^ char
hash2 = (hash2 * 33) ^ char
}
return (hash1 >>> 0) * 4096 + (hash2 >>> 0)
}
module.exports = hash