/* esm.sh - @noble/hashes@2.4.0/sha2 */
import{Chi as $,HashMD as X,Maj as v,SHA224_IV as I,SHA256_IV as V,SHA384_IV as t0,SHA512_IV as c0}from"./_md.mjs";import*as t from"./_u64.mjs";import{clean as M,createHasher as g,oidNist as U,rotr as p}from"./utils.mjs";var s0=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),F=new Uint32Array(64),T=class extends X{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(b,c){super(64,b,8,!1),this.A=c[0]|0,this.B=c[1]|0,this.C=c[2]|0,this.D=c[3]|0,this.E=c[4]|0,this.F=c[5]|0,this.G=c[6]|0,this.H=c[7]|0}get(){let{A:b,B:c,C:e,D:x,E:r,F:o,G:a,H:f}=this;return[b,c,e,x,r,o,a,f]}set(b,c,e,x,r,o,a,f){this.A=b|0,this.B=c|0,this.C=e|0,this.D=x|0,this.E=r|0,this.F=o|0,this.G=a|0,this.H=f|0}_cloneInto(b){return(b||=new this.constructor).set(...this.get()),this._cloneIntoMeta(b)}process(b,c){for(let s=0;s<16;s++,c+=4)F[s]=b.getUint32(c,!1);for(let s=16;s<64;s++){let d=F[s-15],i=F[s-2],H=p(d,7)^p(d,18)^d>>>3,u=p(i,17)^p(i,19)^i>>>10;F[s]=u+F[s-7]+H+F[s-16]|0}let{A:e,B:x,C:r,D:o,E:a,F:f,G:n,H:l}=this;for(let s=0;s<64;s++){let d=p(a,6)^p(a,11)^p(a,25),i=l+d+$(a,f,n)+s0[s]+F[s]|0,u=(p(e,2)^p(e,13)^p(e,22))+v(e,x,r)|0;l=n,n=f,f=a,a=o+i|0,o=r,r=x,x=e,e=i+u|0}e=e+this.A|0,x=x+this.B|0,r=r+this.C|0,o=o+this.D|0,a=a+this.E|0,f=f+this.F|0,n=n+this.G|0,l=l+this.H|0,this.set(e,x,r,o,a,f,n,l)}roundClean(){M(F)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),M(this.buffer)}},k=class extends T{constructor(){super(32,V)}},q=class extends T{constructor(){super(28,I)}},Y=t.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(B=>BigInt(B))),e0=Y[0],x0=Y[1],G=new Uint32Array(80),m=new Uint32Array(80),L=class extends X{Ah=0;Al=0;Bh=0;Bl=0;Ch=0;Cl=0;Dh=0;Dl=0;Eh=0;El=0;Fh=0;Fl=0;Gh=0;Gl=0;Hh=0;Hl=0;constructor(b,c){super(128,b,16,!1),this.Ah=c[0]|0,this.Al=c[1]|0,this.Bh=c[2]|0,this.Bl=c[3]|0,this.Ch=c[4]|0,this.Cl=c[5]|0,this.Dh=c[6]|0,this.Dl=c[7]|0,this.Eh=c[8]|0,this.El=c[9]|0,this.Fh=c[10]|0,this.Fl=c[11]|0,this.Gh=c[12]|0,this.Gl=c[13]|0,this.Hh=c[14]|0,this.Hl=c[15]|0}get(){let{Ah:b,Al:c,Bh:e,Bl:x,Ch:r,Cl:o,Dh:a,Dl:f,Eh:n,El:l,Fh:s,Fl:d,Gh:i,Gl:H,Hh:u,Hl:A}=this;return[b,c,e,x,r,o,a,f,n,l,s,d,i,H,u,A]}set(b,c,e,x,r,o,a,f,n,l,s,d,i,H,u,A){this.Ah=b|0,this.Al=c|0,this.Bh=e|0,this.Bl=x|0,this.Ch=r|0,this.Cl=o|0,this.Dh=a|0,this.Dl=f|0,this.Eh=n|0,this.El=l|0,this.Fh=s|0,this.Fl=d|0,this.Gh=i|0,this.Gl=H|0,this.Hh=u|0,this.Hl=A|0}_cloneInto(b){return(b||=new this.constructor).set(...this.get()),this._cloneIntoMeta(b)}process(b,c){for(let h=0;h<16;h++,c+=4)G[h]=b.getUint32(c),m[h]=b.getUint32(c+=4);for(let h=16;h<80;h++){let D=G[h-15]|0,E=m[h-15]|0,K=t.rotrSH(D,E,1)^t.rotrSH(D,E,8)^t.shrSH(D,E,7),J=t.rotrSL(D,E,1)^t.rotrSL(D,E,8)^t.shrSL(D,E,7),C=G[h-2]|0,S=m[h-2]|0,_=t.rotrSH(C,S,19)^t.rotrBH(C,S,61)^t.shrSH(C,S,6),j=t.rotrSL(C,S,19)^t.rotrBL(C,S,61)^t.shrSL(C,S,6),W=t.add4L(J,j,m[h-7],m[h-16]),N=t.add4H(W,K,_,G[h-7],G[h-16]);G[h]=N|0,m[h]=W|0}let{Ah:e,Al:x,Bh:r,Bl:o,Ch:a,Cl:f,Dh:n,Dl:l,Eh:s,El:d,Fh:i,Fl:H,Gh:u,Gl:A,Hh:w,Hl:y}=this;for(let h=0;h<80;h++){let D=t.rotrSH(s,d,14)^t.rotrSH(s,d,18)^t.rotrBH(s,d,41),E=t.rotrSL(s,d,14)^t.rotrSL(s,d,18)^t.rotrBL(s,d,41),K=s&i^~s&u,J=d&H^~d&A,C=t.add5L(y,E,J,x0[h],m[h]),S=t.add5H(C,w,D,K,e0[h],G[h]),_=C|0,j=t.rotrSH(e,x,28)^t.rotrBH(e,x,34)^t.rotrBH(e,x,39),W=t.rotrSL(e,x,28)^t.rotrBL(e,x,34)^t.rotrBL(e,x,39),N=e&r^e&a^r&a,Z=x&o^x&f^o&f;w=u|0,y=A|0,u=i|0,A=H|0,i=s|0,H=d|0,{h:s,l:d}=t.add(n|0,l|0,S|0,_|0),n=a|0,l=f|0,a=r|0,f=o|0,r=e|0,o=x|0;let R=t.add3L(_,W,Z);e=t.add3H(R,S,j,N),x=R|0}({h:e,l:x}=t.add(this.Ah|0,this.Al|0,e|0,x|0)),{h:r,l:o}=t.add(this.Bh|0,this.Bl|0,r|0,o|0),{h:a,l:f}=t.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:n,l}=t.add(this.Dh|0,this.Dl|0,n|0,l|0),{h:s,l:d}=t.add(this.Eh|0,this.El|0,s|0,d|0),{h:i,l:H}=t.add(this.Fh|0,this.Fl|0,i|0,H|0),{h:u,l:A}=t.add(this.Gh|0,this.Gl|0,u|0,A|0),{h:w,l:y}=t.add(this.Hh|0,this.Hl|0,w|0,y|0),this.set(e,x,r,o,a,f,n,l,s,d,i,H,u,A,w,y)}roundClean(){M(G,m)}destroy(){this.destroyed=!0,M(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},z=class extends L{constructor(){super(64,c0)}},O=class extends L{constructor(){super(48,t0)}},a0=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),h0=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]),P=class extends L{constructor(){super(28,a0)}},Q=class extends L{constructor(){super(32,h0)}},r0=g(()=>new k,U(1)),f0=g(()=>new q,U(4)),o0=g(()=>new z,U(3)),i0=g(()=>new O,U(2)),n0=g(()=>new Q,U(6)),l0=g(()=>new P,U(5));export{q as _SHA224,k as _SHA256,O as _SHA384,z as _SHA512,P as _SHA512_224,Q as _SHA512_256,f0 as sha224,r0 as sha256,i0 as sha384,o0 as sha512,l0 as sha512_224,n0 as sha512_256};
//# sourceMappingURL=sha2.mjs.map