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