初始化
This commit is contained in:
17
uni_modules/UniDevTools/node_modules/string-hash/index.js
generated
vendored
Normal file
17
uni_modules/UniDevTools/node_modules/string-hash/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
function hash(str) {
|
||||
var hash = 5381,
|
||||
i = str.length;
|
||||
|
||||
while(i) {
|
||||
hash = (hash * 33) ^ str.charCodeAt(--i);
|
||||
}
|
||||
|
||||
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
||||
* integers. Since we want the results to be always positive, convert the
|
||||
* signed int to an unsigned by doing an unsigned bitshift. */
|
||||
return hash >>> 0;
|
||||
}
|
||||
|
||||
module.exports = hash;
|
||||
Reference in New Issue
Block a user