-
Notifications
You must be signed in to change notification settings - Fork 44
/
murmurhash3.min.js
1 lines (1 loc) · 1.25 KB
/
murmurhash3.min.js
1
!function(t,r){r(function(r,u,h){return h.exports=e,t.MurmurHash3=e,e});var e={mul32:function(t,r){var e=65535&r,u=r-e;return(u*t|0)+(e*t|0)|0},hashBytes:function(t,r,e){for(var u=3432918353,h=461845907,o=e,i=-4&r,s=0;i>s;s+=4){var a=255&t.charCodeAt(s)|(255&t.charCodeAt(s+1))<<8|(255&t.charCodeAt(s+2))<<16|(255&t.charCodeAt(s+3))<<24;a=this.mul32(a,u),a=(131071&a)<<15|a>>>17,a=this.mul32(a,h),o^=a,o=(524287&o)<<13|o>>>19,o=5*o+3864292196|0}switch(a=0,r%4){case 3:a=(255&t.charCodeAt(i+2))<<16;case 2:a|=(255&t.charCodeAt(i+1))<<8;case 1:a|=255&t.charCodeAt(i),a=this.mul32(a,u),a=(131071&a)<<15|a>>>17,a=this.mul32(a,h),o^=a}return o^=r,o^=o>>>16,o=this.mul32(o,2246822507),o^=o>>>13,o=this.mul32(o,3266489909),o^=o>>>16},hashString:function(t,r,e){for(var u=3432918353,h=461845907,o=e,i=-2&r,s=0;i>s;s+=2){var a=t.charCodeAt(s)|t.charCodeAt(s+1)<<16;a=this.mul32(a,u),a=(131071&a)<<15|a>>>17,a=this.mul32(a,h),o^=a,o=(524287&o)<<13|o>>>19,o=5*o+3864292196|0}return r%2==1&&(a=t.charCodeAt(i),a=this.mul32(a,u),a=(131071&a)<<15|a>>>17,a=this.mul32(a,h),o^=a),o^=r<<1,o^=o>>>16,o=this.mul32(o,2246822507),o^=o>>>13,o=this.mul32(o,3266489909),o^=o>>>16}}}(this,"object"==typeof module&&"function"!=typeof define?function(t){module.exports=t(require,exports,module)}:define);