From: Ardis Lu Date: Sat, 5 Oct 2024 05:07:47 +0000 (-0700) Subject: Further minify by mangling props and strings X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=19e795ca8b9df22901d125bf3705bd715b9b7e85;p=event-hashes Further minify by mangling props and strings WARNING: this is a breaking change with the library, but OK because the breaking changes do not affect this specific application. --- diff --git a/keccak256.js b/keccak256.js index 40fa098..cc88ab2 100644 --- a/keccak256.js +++ b/keccak256.js @@ -1,6 +1,2 @@ -function b(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function M(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function p(t,...e){if(!M(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function k(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function m(t,e){p(t);let n=e.outputLen;if(t.length>A&x)}:{h:Number(t>>A&x)|0,l:Number(t&x)|0}}function B(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;st<>>32-n,I=(t,e,n)=>e<>>32-n,S=(t,e,n)=>e<>>64-n,H=(t,e,n)=>t<>>64-n;var E=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));var L=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,P=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function _(t){for(let e=0;et().update(w(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function T(t){let e=(r,s)=>t(s).update(w(r)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}var X=[],$=[],C=[],v=BigInt(0),h=BigInt(1),q=BigInt(2),z=BigInt(7),G=BigInt(256),J=BigInt(113);for(let t=0,e=h,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],X.push(2*(5*r+n)),$.push((t+1)*(t+2)/2%64);let s=v;for(let i=0;i<7;i++)e=(e<>z)*J)%G,e&q&&(s^=h<<(h<n>32?S(t,e,n):O(t,e,n),j=(t,e,n)=>n>32?H(t,e,n):I(t,e,n);function Y(t,e=24){let n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){let c=(o+8)%10,l=(o+2)%10,a=n[l],u=n[l+1],R=F(a,u,1)^n[c],V=j(a,u,1)^n[c+1];for(let d=0;d<50;d+=10)t[o+d]^=R,t[o+d+1]^=V}let s=t[2],i=t[3];for(let o=0;o<24;o++){let c=$[o],l=F(s,i,c),a=j(s,i,c),u=X[o];s=t[u],i=t[u+1],t[u]=l,t[u+1]=a}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)n[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~n[(c+2)%10]&n[(c+4)%10]}t[0]^=K[r],t[1]^=Q[r]}n.fill(0)}var g=class t extends y{constructor(e,n,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,b(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=E(this.state)}keccak(){L||_(this.state32),Y(this.state32,this.rounds),L||_(this.state32),this.posOut=0,this.pos=0}update(e){k(this);let{blockLen:n,state:r}=this;e=w(e);let s=e.length;for(let i=0;i=r&&this.keccak();let o=Math.min(r-this.posOut,i-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return b(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(m(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new t(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}},f=(t,e,n)=>U(()=>new g(e,t,n)),ft=f(6,144,224/8),ut=f(6,136,256/8),pt=f(6,104,384/8),ht=f(6,72,512/8),lt=f(1,144,224/8),Z=f(1,136,256/8),at=f(1,104,384/8),dt=f(1,72,512/8),N=(t,e,n)=>T((r={})=>new g(e,t,r.dkLen===void 0?n:r.dkLen,!0)),xt=N(31,168,128/8),yt=N(31,136,256/8);export{Z as keccak256}; -/*! Bundled license information: - -@noble/hashes/esm/utils.js: - (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) -*/ +function b(t){if(!Number.isSafeInteger(t)||t<0)throw new Error()}function M(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function p(t,...e){if(!M(t))throw new Error();if(e.length>0&&!e.includes(t.length))throw new Error()}function k(t,e=!0){if(t.d)throw new Error();if(e&&t.f)throw new Error()}function m(t,e){p(t);let n=e.o;if(t.length>A&x)}:{h:Number(t>>A&x)|0,l:Number(t&x)|0}}function B(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;st<>>32-n,I=(t,e,n)=>e<>>32-n,S=(t,e,n)=>e<>>64-n,H=(t,e,n)=>t<>>64-n;var E=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));var L=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,P=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function _(t){for(let e=0;et().u(w(r)).g(),n=t();return e.o=n.o,e.b=n.b,e.c=()=>t(),e}function T(t){let e=(r,s)=>t(s).u(w(r)).g(),n=t({});return e.o=n.o,e.b=n.b,e.c=r=>t(r),e}var X=[],$=[],C=[],v=0n,h=1n,q=2n,z=7n,G=256n,J=113n;for(let t=0,e=h,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],X.push(2*(5*r+n)),$.push((t+1)*(t+2)/2%64);let s=v;for(let i=0;i<7;i++)e=(e<>z)*J)%G,e&q&&(s^=h<<(h<n>32?S(t,e,n):O(t,e,n),j=(t,e,n)=>n>32?H(t,e,n):I(t,e,n);function Y(t,e=24){let n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){let c=(o+8)%10,l=(o+2)%10,a=n[l],u=n[l+1],R=F(a,u,1)^n[c],V=j(a,u,1)^n[c+1];for(let d=0;d<50;d+=10)t[o+d]^=R,t[o+d+1]^=V}let s=t[2],i=t[3];for(let o=0;o<24;o++){let c=$[o],l=F(s,i,c),a=j(s,i,c),u=X[o];s=t[u],i=t[u+1],t[u]=l,t[u+1]=a}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)n[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~n[(c+2)%10]&n[(c+4)%10]}t[0]^=K[r],t[1]^=Q[r]}n.fill(0)}var g=class t{constructor(e,n,r,s=!1,i=24){if(this.b=e,this.s=n,this.o=r,this.e=s,this.r=i,this.po=0,this.p=0,this.f=!1,this.d=!1,b(r),0>=this.b||this.b>=200)throw new Error();this.q=new Uint8Array(200),this.s3=E(this.q)}k(){L||_(this.s3),Y(this.s3,this.r),L||_(this.s3),this.p=0,this.po=0}u(e){k(this);let{b:n,q:r}=this;e=w(e);let s=e.length;for(let i=0;i=r&&this.k();let o=Math.min(r-this.p,i-s);e.set(n.subarray(this.p,this.p+o),s),this.p+=o,s+=o}return e}x(e){if(!this.e)throw new Error();return this.w(e)}xof(e){return b(e),this.x(new Uint8Array(e))}di(e){if(m(e,this),this.f)throw new Error();return this.w(e),this.de(),e}g(){return this.di(new Uint8Array(this.o))}de(){this.d=!0,this.q.fill(0)}c(e){let{b:n,s:r,o:s,r:i,e:o}=this;return e||(e=new t(n,r,s,o,i)),e.s3.set(this.s3),e.po=this.po,e.p=this.p,e.f=this.f,e.r=i,e.s=r,e.o=s,e.e=o,e.d=this.d,e}},f=(t,e,n)=>U(()=>new g(e,t,n)),ft=f(6,144,224/8),ut=f(6,136,256/8),pt=f(6,104,384/8),ht=f(6,72,512/8),lt=f(1,144,224/8),Z=f(1,136,256/8),at=f(1,104,384/8),dt=f(1,72,512/8),N=(t,e,n)=>T((r={})=>new g(e,t,r.D===void 0?n:r.D,!0)),xt=N(31,168,128/8),yt=N(31,136,256/8);export{Z as keccak256}; +// noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com)