/* esm.sh - @noble/hashes@2.4.0/_md */
import{setU64FromNum as p}from"./_u64.mjs";import{abytes as l,aexists as d,aoutput as g,createView as a}from"./utils.mjs";function y(x,e,t){return x&e^~x&t}function w(x,e,t){return x&e^x&t^e&t}var u=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,s,i){this.blockLen=e,this.outputLen=t,this.padOffset=s,this.isLE=i,this.buffer=new Uint8Array(e),this.view=a(this.buffer)}update(e){d(this),l(e);let{view:t,buffer:s,blockLen:i}=this,o=e.length,n=!1;for(let f=0;f<o;){let r=Math.min(i-this.pos,o-f);if(r===i){let c=a(e);for(;i<=o-f;f+=i)this.process(c,f);n=!0;continue}s.set(f===0&&r===o?e:e.subarray(f,f+r),this.pos),this.pos+=r,f+=r,this.pos===i&&(this.process(t,0),this.pos=0,n=!0)}return this.length+=e.length,n&&this.roundClean(),this}digestInto(e){d(this),g(e,this),this.finished=!0;let{buffer:t,view:s,blockLen:i,isLE:o}=this,{pos:n}=this;t[n++]=128,t.fill(0,n),this.padOffset>i-n&&(this.process(s,0),t.fill(0)),p(s,i-8,this.length*8,o),this.process(s,0),this.roundClean();let f=e===t?s:a(e),r=this.outputLen,c=r/4,b=this.get();if(r%4||c>b.length)throw new Error("invalid outputLen");for(let h=0;h<c;h++)f.setUint32(4*h,b[h],o)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let s=e.slice(0,t);return this.destroy(),s}_cloneIntoMeta(e){let{buffer:t,length:s,finished:i,destroyed:o,pos:n}=this;return e.destroyed=o,e.finished=i,e.length=s,e.pos=n,n&&e.buffer.set(t),e}clone(){return this._cloneInto()}},A=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),I=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),U=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),v=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);export{y as Chi,u as HashMD,w as Maj,I as SHA224_IV,A as SHA256_IV,U as SHA384_IV,v as SHA512_IV};
//# sourceMappingURL=_md.mjs.map