'use strict'; // MD5 is required by Baidu's upload protocol; it is not used for authentication. const ZhaoFileHash=(()=>{ const shifts=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21]; const constants=Array.from({length:64},(_,i)=>Math.floor(Math.abs(Math.sin(i+1))*4294967296)|0); function md5(input){ const bytes=new Uint8Array(input),length=bytes.length,padded=new Uint8Array(Math.ceil((length+9)/64)*64); padded.set(bytes);padded[length]=128;const view=new DataView(padded.buffer); view.setUint32(padded.length-8,(length*8)>>>0,true);view.setUint32(padded.length-4,Math.floor(length/536870912),true); let h=[0x67452301,0xefcdab89|0,0x98badcfe|0,0x10325476]; for(let offset=0;offset>>(32-shift))))|0;a=d;d=c;c=b;b=next; } h=[(h[0]+a)|0,(h[1]+b)|0,(h[2]+c)|0,(h[3]+d)|0]; } return h.map(n=>[0,8,16,24].map(s=>((n>>>s)&255).toString(16).padStart(2,'0')).join('')).join(''); } async function blocks(file,progress=()=>{},valid=()=>true){ const result=[]; for(let offset=0;offsetsetTimeout(resolve,0)); } return result; } return {md5,blocks}; })(); if(typeof module!=='undefined')module.exports=ZhaoFileHash;