Comparing version 0.0.3 to 0.0.4
@@ -710,3 +710,3 @@ // This file was automatically generated from "xxhash.lmd.json" | ||
this.memsize = 0 | ||
this.memory = new Buffer(16) | ||
this.memory = null | ||
@@ -733,3 +733,3 @@ return this | ||
if (this.memsize == 0 && isString) this.memory = '' | ||
if (this.memsize == 0) this.memory = isString ? '' : new Buffer(16) | ||
@@ -736,0 +736,0 @@ if (this.memsize + len < 16) // fill in tmp buffer |
@@ -1,1 +0,1 @@ | ||
(function(e,t,n,r,i){var s={},o=function(t){return e.Function("return "+t)()},u=e.document,a,f=function(t,i){var o={exports:{}};s[t]=1,n[t]=o.exports;if(!i)i=i||e[t];else if(typeof i=="function"){var u=l;r[t]&&r[t].sandbox&&typeof u=="function"&&(u=a),i=i(u,o.exports,o)||o.exports}return i=i,n[t]=i},l=function(e){var t=n[e],r=[e,t];return r&&(e=r[0],t=r[1]),s[e]&&t?t:(typeof t=="string"&&t.indexOf("(function(")===0&&(t=o(t)),f(e,t))},c={exports:{}};for(var h in n)s[h]=0;t(l,c.exports,c)})(this,function(e,t,n){window.XXH=e("xxhash")},{"./lib/uint32":function(e,t,n){(function(e){function t(e,n){if(!(this instanceof t))return new t(e,n);this._low=0,this._high=0,this.remainder=null;if(typeof n=="undefined")return i.call(this,e);if(typeof e=="string")return s.call(this,e,n);r.call(this,e,n)}function r(e,t){return this._low=e|0,this._high=t|0,this}function i(e){return this._low=e&65535,this._high=e>>>16,this}function s(e,t){var n=parseInt(e,t||10);return this._low=n&65535,this._high=n>>>16,this}var o={36:t(Math.pow(36,5)),16:t(Math.pow(16,7)),10:t(Math.pow(10,9)),2:t(Math.pow(2,30))},u={36:t(36),16:t(16),10:t(10),2:t(2)};t.prototype.fromBits=r,t.prototype.fromNumber=i,t.prototype.fromString=s,t.prototype.toNumber=function(){return this._high<<16|this._low},t.prototype.toString=function(e){e=e||10;var n=u[e]||new t(e);if(!this.gt(n))return this.toNumber().toString(e);var r=this.clone(),i=new Array(32);for(var s=31;s>=0;s--){r.div(n),i[s]=r.remainder.toNumber().toString(e);if(!r.gt(n))break}return i[s-1]=r.toNumber().toString(e),i.join("")},t.prototype.add=function(e){var t=this._low+e._low,n=t>>>16;return n+=this._high+e._high,this._low=t&65535,this._high=n&65535,this},t.prototype.subtract=function(e){return this.add(e.clone().negate())},t.prototype.multiply=function(e){var t=this._high,n=this._low,r=e._high,i=e._low,s,o;return o=n*i,s=o>>>16,s+=t*i,s&=65535,s+=n*r,this._low=o&65535,this._high=s&65535,this},t.prototype.div=function(e){if(e._low==0&&e._high==0)throw Error("division by zero");if(e._high==0&&e._low==1)return this.remainder=new t(0),this;if(e.gt(this))return this.remainder=new t(0),this._low=0,this._high=0,this;if(this.eq(e))return this.remainder=new t(0),this._low=1,this._high=0,this;var n=e.clone(),r=-1;while(!this.lt(n))n.shiftLeft(1,!0),r++;this.remainder=this.clone(),this._low=0,this._high=0;for(;r>=0;r--)n.shiftRight(1),this.remainder.lt(n)||(this.remainder.subtract(n),r>=16?this._high|=1<<r-16:this._low|=1<<r);return this},t.prototype.negate=t.prototype.not=function(){var e=(~this._low&65535)+1;return this._low=e&65535,this._high=~this._high+(e>>>16)&65535,this},t.prototype.equals=t.prototype.eq=function(e){return this._low==e._low&&this._high==e._high},t.prototype.greaterThan=t.prototype.gt=function(e){return this._high>e._high?!0:this._high<e._high?!1:this._low>e._low},t.prototype.lessThan=t.prototype.lt=function(e){return this._high<e._high?!0:this._high>e._high?!1:this._low<e._low},t.prototype.or=function(e){return this._low|=e._low,this._high|=e._high,this},t.prototype.and=function(e){return this._low&=e._low,this._high&=e._high,this},t.prototype.xor=function(e){return this._low^=e._low,this._high^=e._high,this},t.prototype.shiftRight=t.prototype.shiftr=function(e){return e>16?(this._low=this._high>>e-16,this._high=0):e==16?(this._low=this._high,this._high=0):(this._low=this._low>>e|this._high<<16-e&65535,this._high>>=e),this},t.prototype.shiftLeft=t.prototype.shiftl=function(e,t){return e>16?(this._high=this._low<<e-16,this._low=0,t||(this._high&=65535)):e==16?(this._high=this._low,this._low=0):(this._high=this._high<<e|this._low>>16-e,this._low=this._low<<e&65535,t||(this._high&=65535)),this},t.prototype.rotateLeft=t.prototype.rotl=function(e){var t=this._high<<16|this._low;return t=t<<e|t>>>32-e,this._low=t&65535,this._high=t>>>16,this},t.prototype.rotateRight=t.prototype.rotr=function(e){var t=this._high<<16|this._low;return t=t>>>e|t<<32-e,this._low=t&65535,this._high=t>>>16,this},t.prototype.clone=function(){return new t(this._low,this._high)},typeof define!="undefined"&&define.amd?define([],function(){return t}):typeof n!="undefined"&&n.exports?n.exports=t:e.UINT32=t})(this)},cuint:function(e,t,n){t.UINT32=e("./lib/uint32"),t.UINT64=e("./lib/uint64")},xxhash:function(e,t,n){(function(t){function r(){if(arguments.length==2)return(new r(arguments[1])).update(arguments[0]).digest();if(!(this instanceof r))return new r(arguments[0]);i.call(this,arguments[0])}function i(e){return this.seed=e instanceof s?e.clone():s(e),this.v1=this.seed.clone().add(c),this.v2=this.seed.clone().add(u),this.v3=this.seed.clone(),this.v4=this.seed.clone().subtract(o),this.total_len=0,this.memsize=0,this.memory=new Buffer(16),this}var s=e("cuint").UINT32;s.prototype.xxh_update=function(e,t){var n=u._low,r=u._high,i,s;s=e*n,i=s>>>16,i+=t*n,i&=65535,i+=e*r;var a=this._low+(s&65535),f=a>>>16;f+=this._high+(i&65535);var l=f<<16|a&65535;l=l<<13|l>>>19,a=l&65535,f=l>>>16,n=o._low,r=o._high,s=a*n,i=s>>>16,i+=f*n,i&=65535,i+=a*r,this._low=s&65535,this._high=i&65535};var o=s("2654435761"),u=s("2246822519"),a=s("3266489917"),f=s("668265263"),l=s("374761393"),c=o.clone().add(u);r.prototype.init=i,r.prototype.update=function(e){var t=typeof e=="string",n=0,r=e.length,i=n+r;if(r==0)return this;this.total_len+=r,this.memsize==0&&t&&(this.memory="");if(this.memsize+r<16)return t?this.memory+=e:e.copy(this.memory,this.memsize,0,r),this.memsize+=r,this;if(this.memsize>0){t?this.memory+=e.slice(0,16-this.memsize):e.copy(this.memory,this.memsize,0,16-this.memsize);var s=0;t?(this.v1.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2)),s+=4,this.v2.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2)),s+=4,this.v3.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2)),s+=4,this.v4.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2))):(this.v1.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2]),s+=4,this.v2.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2]),s+=4,this.v3.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2]),s+=4,this.v4.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2])),n+=16-this.memsize,this.memsize=0,t&&(this.memory="")}if(n<=i-16){var o=i-16;do t?(this.v1.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)),n+=4,this.v2.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)),n+=4,this.v3.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)),n+=4,this.v4.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2))):(this.v1.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),n+=4,this.v2.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),n+=4,this.v3.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),n+=4,this.v4.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2])),n+=4;while(n<=o)}return n<i&&(t?this.memory+=e.slice(n):e.copy(this.memory,this.memsize,n,i),this.memsize=i-n),this},r.prototype.digest=function(){var e=this.memory,t=typeof e=="string",n=0,r=this.memsize,i,c,h=new s;this.total_len>=16?i=this.v1.rotl(1).add(this.v2.rotl(7).add(this.v3.rotl(12).add(this.v4.rotl(18)))):i=this.seed.add(l),i.add(h.fromNumber(this.total_len));while(n<=r-4)t?h.fromBits(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)):h.fromBits(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),i.add(h.multiply(a)).rotl(17).multiply(f),n+=4;while(n<r)h.fromBits(t?e.charCodeAt(n++):e[n++],0),i.add(h.multiply(l)).rotl(11).multiply(o);return c=i.clone().shiftRight(15),i.xor(c).multiply(u),c=i.clone().shiftRight(13),i.xor(c).multiply(a),c=i.clone().shiftRight(16),i.xor(c),this.init(this.seed),i},typeof define!="undefined"&&define.amd?define([],function(){return r}):typeof n!="undefined"&&n.exports?n.exports=r:t.XXH=r})(this)}},{},{}) | ||
(function(e,t,n,r,i){var s={},o=function(t){return e.Function("return "+t)()},u=e.document,a,f=function(t,i){var o={exports:{}};s[t]=1,n[t]=o.exports;if(!i)i=i||e[t];else if(typeof i=="function"){var u=l;r[t]&&r[t].sandbox&&typeof u=="function"&&(u=a),i=i(u,o.exports,o)||o.exports}return i=i,n[t]=i},l=function(e){var t=n[e],r=[e,t];return r&&(e=r[0],t=r[1]),s[e]&&t?t:(typeof t=="string"&&t.indexOf("(function(")===0&&(t=o(t)),f(e,t))},c={exports:{}};for(var h in n)s[h]=0;t(l,c.exports,c)})(this,function(e,t,n){window.XXH=e("xxhash")},{"./lib/uint32":function(e,t,n){(function(e){function t(e,n){if(!(this instanceof t))return new t(e,n);this._low=0,this._high=0,this.remainder=null;if(typeof n=="undefined")return i.call(this,e);if(typeof e=="string")return s.call(this,e,n);r.call(this,e,n)}function r(e,t){return this._low=e|0,this._high=t|0,this}function i(e){return this._low=e&65535,this._high=e>>>16,this}function s(e,t){var n=parseInt(e,t||10);return this._low=n&65535,this._high=n>>>16,this}var o={36:t(Math.pow(36,5)),16:t(Math.pow(16,7)),10:t(Math.pow(10,9)),2:t(Math.pow(2,30))},u={36:t(36),16:t(16),10:t(10),2:t(2)};t.prototype.fromBits=r,t.prototype.fromNumber=i,t.prototype.fromString=s,t.prototype.toNumber=function(){return this._high<<16|this._low},t.prototype.toString=function(e){e=e||10;var n=u[e]||new t(e);if(!this.gt(n))return this.toNumber().toString(e);var r=this.clone(),i=new Array(32);for(var s=31;s>=0;s--){r.div(n),i[s]=r.remainder.toNumber().toString(e);if(!r.gt(n))break}return i[s-1]=r.toNumber().toString(e),i.join("")},t.prototype.add=function(e){var t=this._low+e._low,n=t>>>16;return n+=this._high+e._high,this._low=t&65535,this._high=n&65535,this},t.prototype.subtract=function(e){return this.add(e.clone().negate())},t.prototype.multiply=function(e){var t=this._high,n=this._low,r=e._high,i=e._low,s,o;return o=n*i,s=o>>>16,s+=t*i,s&=65535,s+=n*r,this._low=o&65535,this._high=s&65535,this},t.prototype.div=function(e){if(e._low==0&&e._high==0)throw Error("division by zero");if(e._high==0&&e._low==1)return this.remainder=new t(0),this;if(e.gt(this))return this.remainder=new t(0),this._low=0,this._high=0,this;if(this.eq(e))return this.remainder=new t(0),this._low=1,this._high=0,this;var n=e.clone(),r=-1;while(!this.lt(n))n.shiftLeft(1,!0),r++;this.remainder=this.clone(),this._low=0,this._high=0;for(;r>=0;r--)n.shiftRight(1),this.remainder.lt(n)||(this.remainder.subtract(n),r>=16?this._high|=1<<r-16:this._low|=1<<r);return this},t.prototype.negate=t.prototype.not=function(){var e=(~this._low&65535)+1;return this._low=e&65535,this._high=~this._high+(e>>>16)&65535,this},t.prototype.equals=t.prototype.eq=function(e){return this._low==e._low&&this._high==e._high},t.prototype.greaterThan=t.prototype.gt=function(e){return this._high>e._high?!0:this._high<e._high?!1:this._low>e._low},t.prototype.lessThan=t.prototype.lt=function(e){return this._high<e._high?!0:this._high>e._high?!1:this._low<e._low},t.prototype.or=function(e){return this._low|=e._low,this._high|=e._high,this},t.prototype.and=function(e){return this._low&=e._low,this._high&=e._high,this},t.prototype.xor=function(e){return this._low^=e._low,this._high^=e._high,this},t.prototype.shiftRight=t.prototype.shiftr=function(e){return e>16?(this._low=this._high>>e-16,this._high=0):e==16?(this._low=this._high,this._high=0):(this._low=this._low>>e|this._high<<16-e&65535,this._high>>=e),this},t.prototype.shiftLeft=t.prototype.shiftl=function(e,t){return e>16?(this._high=this._low<<e-16,this._low=0,t||(this._high&=65535)):e==16?(this._high=this._low,this._low=0):(this._high=this._high<<e|this._low>>16-e,this._low=this._low<<e&65535,t||(this._high&=65535)),this},t.prototype.rotateLeft=t.prototype.rotl=function(e){var t=this._high<<16|this._low;return t=t<<e|t>>>32-e,this._low=t&65535,this._high=t>>>16,this},t.prototype.rotateRight=t.prototype.rotr=function(e){var t=this._high<<16|this._low;return t=t>>>e|t<<32-e,this._low=t&65535,this._high=t>>>16,this},t.prototype.clone=function(){return new t(this._low,this._high)},typeof define!="undefined"&&define.amd?define([],function(){return t}):typeof n!="undefined"&&n.exports?n.exports=t:e.UINT32=t})(this)},cuint:function(e,t,n){t.UINT32=e("./lib/uint32"),t.UINT64=e("./lib/uint64")},xxhash:function(e,t,n){(function(t){function r(){if(arguments.length==2)return(new r(arguments[1])).update(arguments[0]).digest();if(!(this instanceof r))return new r(arguments[0]);i.call(this,arguments[0])}function i(e){return this.seed=e instanceof s?e.clone():s(e),this.v1=this.seed.clone().add(c),this.v2=this.seed.clone().add(u),this.v3=this.seed.clone(),this.v4=this.seed.clone().subtract(o),this.total_len=0,this.memsize=0,this.memory=null,this}var s=e("cuint").UINT32;s.prototype.xxh_update=function(e,t){var n=u._low,r=u._high,i,s;s=e*n,i=s>>>16,i+=t*n,i&=65535,i+=e*r;var a=this._low+(s&65535),f=a>>>16;f+=this._high+(i&65535);var l=f<<16|a&65535;l=l<<13|l>>>19,a=l&65535,f=l>>>16,n=o._low,r=o._high,s=a*n,i=s>>>16,i+=f*n,i&=65535,i+=a*r,this._low=s&65535,this._high=i&65535};var o=s("2654435761"),u=s("2246822519"),a=s("3266489917"),f=s("668265263"),l=s("374761393"),c=o.clone().add(u);r.prototype.init=i,r.prototype.update=function(e){var t=typeof e=="string",n=0,r=e.length,i=n+r;if(r==0)return this;this.total_len+=r,this.memsize==0&&(this.memory=t?"":new Buffer(16));if(this.memsize+r<16)return t?this.memory+=e:e.copy(this.memory,this.memsize,0,r),this.memsize+=r,this;if(this.memsize>0){t?this.memory+=e.slice(0,16-this.memsize):e.copy(this.memory,this.memsize,0,16-this.memsize);var s=0;t?(this.v1.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2)),s+=4,this.v2.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2)),s+=4,this.v3.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2)),s+=4,this.v4.xxh_update(this.memory.charCodeAt(s+1)<<8|this.memory.charCodeAt(s),this.memory.charCodeAt(s+3)<<8|this.memory.charCodeAt(s+2))):(this.v1.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2]),s+=4,this.v2.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2]),s+=4,this.v3.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2]),s+=4,this.v4.xxh_update(this.memory[s+1]<<8|this.memory[s],this.memory[s+3]<<8|this.memory[s+2])),n+=16-this.memsize,this.memsize=0,t&&(this.memory="")}if(n<=i-16){var o=i-16;do t?(this.v1.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)),n+=4,this.v2.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)),n+=4,this.v3.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)),n+=4,this.v4.xxh_update(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2))):(this.v1.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),n+=4,this.v2.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),n+=4,this.v3.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),n+=4,this.v4.xxh_update(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2])),n+=4;while(n<=o)}return n<i&&(t?this.memory+=e.slice(n):e.copy(this.memory,this.memsize,n,i),this.memsize=i-n),this},r.prototype.digest=function(){var e=this.memory,t=typeof e=="string",n=0,r=this.memsize,i,c,h=new s;this.total_len>=16?i=this.v1.rotl(1).add(this.v2.rotl(7).add(this.v3.rotl(12).add(this.v4.rotl(18)))):i=this.seed.add(l),i.add(h.fromNumber(this.total_len));while(n<=r-4)t?h.fromBits(e.charCodeAt(n+1)<<8|e.charCodeAt(n),e.charCodeAt(n+3)<<8|e.charCodeAt(n+2)):h.fromBits(e[n+1]<<8|e[n],e[n+3]<<8|e[n+2]),i.add(h.multiply(a)).rotl(17).multiply(f),n+=4;while(n<r)h.fromBits(t?e.charCodeAt(n++):e[n++],0),i.add(h.multiply(l)).rotl(11).multiply(o);return c=i.clone().shiftRight(15),i.xor(c).multiply(u),c=i.clone().shiftRight(13),i.xor(c).multiply(a),c=i.clone().shiftRight(16),i.xor(c),this.init(this.seed),i},typeof define!="undefined"&&define.amd?define([],function(){return r}):typeof n!="undefined"&&n.exports?n.exports=r:t.XXH=r})(this)}},{},{}) |
@@ -0,1 +1,6 @@ | ||
0.0.4 / 2014-04-25 | ||
================== | ||
* Fixed undefined Buffer in browsers | ||
0.0.3 / 2014-03-21 | ||
@@ -2,0 +7,0 @@ ================== |
{ | ||
"name": "xxhashjs", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "xxHash in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "xxhash.js", |
@@ -98,3 +98,3 @@ /** | ||
this.memsize = 0 | ||
this.memory = new Buffer(16) | ||
this.memory = null | ||
@@ -121,3 +121,3 @@ return this | ||
if (this.memsize == 0 && isString) this.memory = '' | ||
if (this.memsize == 0) this.memory = isString ? '' : new Buffer(16) | ||
@@ -124,0 +124,0 @@ if (this.memsize + len < 16) // fill in tmp buffer |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1048107