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