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