@taichunmin/crc
Version:
A cross platform alternative for calculating Cyclic Redundancy Checks (CRC) values.
2 lines (1 loc) • 1.33 kB
JavaScript
function B(x){let t=typeof x;return x!=null&&(t==="object"||t==="function")}function E(x,t,A){if(!B(x)||!Array.isArray(t)||t.length<1)return x;let n=x;for(let e of t.slice(0,-1))B(n[e])||(n[e]={}),n=n[e];return n[t.at(-1)]=A,x}var r=new Uint8Array(1),F=new Uint16Array(1),o=new Uint32Array(1);var D=new Uint8Array([0,47,94,113,188,147,226,205,87,120,9,38,235,196,181,154,174,129,240,223,18,61,76,99,249,214,167,136,69,106,27,52,115,92,45,2,207,224,145,190,36,11,122,85,152,183,198,233,221,242,131,172,97,78,63,16,138,165,212,251,54,25,104,71,230,201,184,151,90,117,4,43,177,158,239,192,13,34,83,124,72,103,22,57,244,219,170,133,31,48,65,110,163,140,253,210,149,186,203,228,41,6,119,88,194,237,156,179,126,81,32,15,59,20,101,74,135,168,217,246,108,67,50,29,208,255,142,161,227,204,189,146,95,112,1,46,180,155,234,197,8,39,86,121,77,98,19,60,241,222,175,128,26,53,68,107,166,137,248,215,144,191,206,225,44,3,114,93,199,232,153,182,123,84,37,10,62,17,96,79,130,173,220,243,105,70,55,24,213,250,139,164,5,42,91,116,185,150,231,200,82,125,12,35,238,193,176,159,171,132,245,218,23,56,73,102,252,211,162,141,64,111,30,49,118,89,40,7,202,229,148,187,33,14,127,80,157,178,195,236,216,247,134,169,100,75,58,21,143,160,209,254,51,28,109,66]);function C(x=new Uint8Array,t=0){r[0]=t;for(let A of x)r[0]=D[r[0]^A];return r[0]}export{C as default};