-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsiphash.min.js
1 lines (1 loc) · 3.21 KB
/
siphash.min.js
1
(function(){"use strict";function r(o,q){function r(n,j,B,C,t,u,v,w){return function(p){var b,a,e,h,i,k,d,c,l,f,g,m,r,z,x,s=p.length,D=o,E=q;a=j;b=n;i=C;h=B;c=u;d=t;g=w;f=v;p+="\x00\x00\x00\x00\x00\x00\x00".slice(s&7);p+=String.fromCharCode(s&255);for(x=0;x<p.length;x+=8){z=y(p,x+4);r=y(p,x);g^=z;f^=r;for(s=0;s<D;s++)e=b>>>16,k=a>>>16,b&=65535,a&=65535,e+=h>>>16,k+=i>>>16,b+=h&65535,a+=i&65535,e+=b>>>16,a+=e>>>16,k+=a>>>16,a&=65535,b&=65535,a^=k<<16,b^=e<<16,l=d>>>16,m=c>>>16,d&=65535,c&=65535,l+=f>>>16,m+=g>>>16,d+=f&65535,c+=g&65535,l+=d>>>16,c+=l>>>16,m+=c>>>16,c&=65535,d&=65535,c^=m<<16,d^=l<<16,k=i>>>19,i<<=13,i|=h>>>19,h<<=13,h|=k,m=g>>>16,g<<=16,g|=f>>>16,f<<=16,f|=m,i^=a,h^=b,g^=c,f^=d,e=a,a=b,b=e,l=d>>>16,k=c>>>16,d&=65535,c&=65535,l+=h>>>16,k+=i>>>16,d+=h&65535,c+=i&65535,l+=d>>>16,c+=l>>>16,k+=c>>>16,c&=65535,d&=65535,c^=k<<16,d^=l<<16,e=b>>>16,m=a>>>16,b&=65535,a&=65535,e+=f>>>16,m+=g>>>16,b+=f&65535,a+=g&65535,e+=b>>>16,a+=e>>>16,m+=a>>>16,a&=65535,b&=65535,a^=m<<16,b^=e<<16,k=i>>>15,i<<=17,i|=h>>>15,h<<=17,h|=k,m=g>>>11,g<<=21,g|=f>>>11,f<<=21,f|=m,i^=c,h^=d,g^=a,f^=b,l=c,c=d,d=l;a^=z;b^=r}d^=255;for(s=0;s<E;s++)e=b>>>16,k=a>>>16,b&=65535,a&=65535,e+=h>>>16,k+=i>>>16,b+=h&65535,a+=i&65535,e+=b>>>16,a+=e>>>16,k+=a>>>16,a&=65535,b&=65535,a^=k<<16,b^=e<<16,l=d>>>16,m=c>>>16,d&=65535,c&=65535,l+=f>>>16,m+=g>>>16,d+=f&65535,c+=g&65535,l+=d>>>16,c+=l>>>16,m+=c>>>16,c&=65535,d&=65535,c^=m<<16,d^=l<<16,k=i>>>19,i<<=13,i|=h>>>19,h<<=13,h|=k,m=g>>>16,g<<=16,g|=f>>>16,f<<=16,f|=m,i^=a,h^=b,g^=c,f^=d,e=a,a=b,b=e,l=d>>>16,k=c>>>16,d&=65535,c&=65535,l+=h>>>16,k+=i>>>16,d+=h&65535,c+=i&65535,l+=d>>>16,c+=l>>>16,k+=c>>>16,c&=65535,d&=65535,c^=k<<16,d^=l<<16,e=b>>>16,m=a>>>16,b&=65535,a&=65535,e+=f>>>16,m+=g>>>16,b+=f&65535,a+=g&65535,e+=b>>>16,a+=e>>>16,m+=a>>>16,a&=65535,b&=65535,a^=m<<16,b^=e<<16,k=i>>>15,i<<=17,i|=h>>>15,h<<=17,h|=k,m=g>>>11,g<<=21,g|=f>>>11,f<<=21,f|=m,i^=c,h^=d,g^=a,f^=b,l=c,c=d,d=l;a^=i;b^=h;c^=g;d^=f;a^=c;b^=d;return new A(b,a)}}function y(n,j){return n.charCodeAt(j)|n.charCodeAt(j+1)<<8|n.charCodeAt(j+2)<<16|n.charCodeAt(j+3)<<24}o=(o>>>=0)||2;q=(q>>>=0)||4;return function(n){var j,o,q,t,u,v,w,p,b,a,e;switch(typeof n){case"string":a=y(n,4);b=y(n,0);e=y(n,12);n=y(n,8);break;case"number":a=0|n/4294967296;b=0|n;e=0;n=0;break;default:if("function"===typeof require&&require("crypto")){j=require("crypto").randomBytes(16);b=j[0]|j[1]<<8|j[2]<<16|j[3]<<24;a=j[4]|j[5]<<8|j[6]<<16|j[7]<<24;n=j[8]|j[9]<<8|j[10]<<16|j[11]<<24;e=j[12]|j[13]<<8|j[14]<<16|j[15]<<24;break}if("undefined"!==typeof crypto&&crypto.getRandomValues){j=new Uint32Array(4);crypto.getRandomValues(j);a=j[1];b=j[0];e=j[3];n=j[2];break}a=0|4294967296*Math.random();b=0|4294967296*Math.random();e=0|4294967296*Math.random();n=0|4294967296*Math.random()}o=1936682341;j=1886610805;t=1685025377;q=1852075885;v=1819895653;u=1852142177;p=1952801890;w=2037671283;o^=a;j^=b;t^=e;q^=n;v^=a;u^=b;p^=e;w^=n;return r(j,o,q,t,u,v,w,p)}}function A(o,q){this.l=o;this.h=q}A.prototype.valueOf=function(){var o=this.h&2097151;return o=4294967296*o+(this.l>>>0)};A.prototype.toString=function(){var o="00000000"+(this.l>>>0).toString(16);return("00000000"+(this.h>>>0).toString(16)).slice(-8)+o.slice(-8)};"undefined"!==typeof module&&(module.exports=r)||(window.SipHash=r)})();