update
This commit is contained in:
138
package/node_modules/imurmurhash/imurmurhash.js
generated
vendored
Normal file
138
package/node_modules/imurmurhash/imurmurhash.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* @preserve
|
||||
* JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
|
||||
*
|
||||
* @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
|
||||
* @see http://github.com/homebrewing/brauhaus-diff
|
||||
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
||||
* @see http://github.com/garycourt/murmurhash-js
|
||||
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
|
||||
* @see http://sites.google.com/site/murmurhash/
|
||||
*/
|
||||
(function(){
|
||||
var cache;
|
||||
|
||||
// Call this function without `new` to use the cached object (good for
|
||||
// single-threaded environments), or with `new` to create a new object.
|
||||
//
|
||||
// @param {string} key A UTF-16 or ASCII string
|
||||
// @param {number} seed An optional positive integer
|
||||
// @return {object} A MurmurHash3 object for incremental hashing
|
||||
function MurmurHash3(key, seed) {
|
||||
var m = this instanceof MurmurHash3 ? this : cache;
|
||||
m.reset(seed)
|
||||
if (typeof key === 'string' && key.length > 0) {
|
||||
m.hash(key);
|
||||
}
|
||||
|
||||
if (m !== this) {
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
// Incrementally add a string to this hash
|
||||
//
|
||||
// @param {string} key A UTF-16 or ASCII string
|
||||
// @return {object} this
|
||||
MurmurHash3.prototype.hash = function(key) {
|
||||
var h1, k1, i, top, len;
|
||||
|
||||
len = key.length;
|
||||
this.len += len;
|
||||
|
||||
k1 = this.k1;
|
||||
i = 0;
|
||||
switch (this.rem) {
|
||||
case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0;
|
||||
case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0;
|
||||
case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0;
|
||||
case 3:
|
||||
k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0;
|
||||
k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0;
|
||||
}
|
||||
|
||||
this.rem = (len + this.rem) & 3; // & 3 is same as % 4
|
||||
len -= this.rem;
|
||||
if (len > 0) {
|
||||
h1 = this.h1;
|
||||
while (1) {
|
||||
k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff;
|
||||
k1 = (k1 << 15) | (k1 >>> 17);
|
||||
k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff;
|
||||
|
||||
h1 ^= k1;
|
||||
h1 = (h1 << 13) | (h1 >>> 19);
|
||||
h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff;
|
||||
|
||||
if (i >= len) {
|
||||
break;
|
||||
}
|
||||
|
||||
k1 = ((key.charCodeAt(i++) & 0xffff)) ^
|
||||
((key.charCodeAt(i++) & 0xffff) << 8) ^
|
||||
((key.charCodeAt(i++) & 0xffff) << 16);
|
||||
top = key.charCodeAt(i++);
|
||||
k1 ^= ((top & 0xff) << 24) ^
|
||||
((top & 0xff00) >> 8);
|
||||
}
|
||||
|
||||
k1 = 0;
|
||||
switch (this.rem) {
|
||||
case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16;
|
||||
case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8;
|
||||
case 1: k1 ^= (key.charCodeAt(i) & 0xffff);
|
||||
}
|
||||
|
||||
this.h1 = h1;
|
||||
}
|
||||
|
||||
this.k1 = k1;
|
||||
return this;
|
||||
};
|
||||
|
||||
// Get the result of this hash
|
||||
//
|
||||
// @return {number} The 32-bit hash
|
||||
MurmurHash3.prototype.result = function() {
|
||||
var k1, h1;
|
||||
|
||||
k1 = this.k1;
|
||||
h1 = this.h1;
|
||||
|
||||
if (k1 > 0) {
|
||||
k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff;
|
||||
k1 = (k1 << 15) | (k1 >>> 17);
|
||||
k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff;
|
||||
h1 ^= k1;
|
||||
}
|
||||
|
||||
h1 ^= this.len;
|
||||
|
||||
h1 ^= h1 >>> 16;
|
||||
h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff;
|
||||
h1 ^= h1 >>> 13;
|
||||
h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff;
|
||||
h1 ^= h1 >>> 16;
|
||||
|
||||
return h1 >>> 0;
|
||||
};
|
||||
|
||||
// Reset the hash object for reuse
|
||||
//
|
||||
// @param {number} seed An optional positive integer
|
||||
MurmurHash3.prototype.reset = function(seed) {
|
||||
this.h1 = typeof seed === 'number' ? seed : 0;
|
||||
this.rem = this.k1 = this.len = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
// A cached object to use. This can be safely used if you're in a single-
|
||||
// threaded environment, otherwise you need to create new hashes to use.
|
||||
cache = new MurmurHash3();
|
||||
|
||||
if (typeof(module) != 'undefined') {
|
||||
module.exports = MurmurHash3;
|
||||
} else {
|
||||
this.MurmurHash3 = MurmurHash3;
|
||||
}
|
||||
}());
|
12
package/node_modules/imurmurhash/imurmurhash.min.js
generated
vendored
Normal file
12
package/node_modules/imurmurhash/imurmurhash.min.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @preserve
|
||||
* JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
|
||||
*
|
||||
* @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
|
||||
* @see http://github.com/homebrewing/brauhaus-diff
|
||||
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
||||
* @see http://github.com/garycourt/murmurhash-js
|
||||
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
|
||||
* @see http://sites.google.com/site/murmurhash/
|
||||
*/
|
||||
!function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}();
|
40
package/node_modules/imurmurhash/package.json
generated
vendored
Normal file
40
package/node_modules/imurmurhash/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "imurmurhash",
|
||||
"version": "0.1.4",
|
||||
"description": "An incremental implementation of MurmurHash3",
|
||||
"homepage": "https://github.com/jensyt/imurmurhash-js",
|
||||
"main": "imurmurhash.js",
|
||||
"files": [
|
||||
"imurmurhash.js",
|
||||
"imurmurhash.min.js",
|
||||
"package.json",
|
||||
"README.md"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jensyt/imurmurhash-js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jensyt/imurmurhash-js/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"murmur",
|
||||
"murmurhash",
|
||||
"murmurhash3",
|
||||
"hash",
|
||||
"incremental"
|
||||
],
|
||||
"author": {
|
||||
"name": "Jens Taylor",
|
||||
"email": "jensyt@gmail.com",
|
||||
"url": "https://github.com/homebrewing"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.19"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user