UNPKG

@taichunmin/crc

Version:

A cross platform alternative for calculating Cyclic Redundancy Checks (CRC) values.

2 lines (1 loc) 1.93 kB
function D(x){let A=typeof x;return x!=null&&(A==="object"||A==="function")}function r(x,A,E){if(!D(x)||!Array.isArray(A)||A.length<1)return x;let B=x;for(let C of A.slice(0,-1))D(B[C])||(B[C]={}),B=B[C];return B[A.at(-1)]=E,x}var e=new Uint8Array(1),F=new Uint16Array(1),c=new Uint32Array(1);var t=new Uint16Array([0,13732,27464,24300,54928,58164,48600,34940,3329,14501,26185,21485,56209,60981,45273,34173,6658,12198,29002,17646,52370,63798,42970,37502,5891,8871,31819,18927,49555,62519,43739,40831,13316,416,24396,27368,58004,55088,35292,48248,14597,3233,21069,26601,61333,55857,34013,45433,11782,7074,17742,28906,63638,52530,37854,42618,8967,5795,18511,32235,62871,49203,40671,43899,26632,23980,832,14052,48792,35644,54736,57460,25865,20653,3649,15333,45977,34365,55505,60789,29194,18350,6466,11494,42138,37182,53202,64118,32523,19119,5187,8679,43419,39999,49875,63351,23564,27048,14148,736,35484,48952,57812,54384,20749,25769,14917,4065,34717,45625,60629,55665,17934,29610,11590,6370,37022,42298,64470,52850,19215,32427,8263,5603,40351,43067,63191,50035,53264,58804,47960,36604,1664,13092,28104,22636,56593,59573,46681,33789,2945,15909,24777,21869,51730,65462,41306,38142,7298,10534,30666,17006,50963,62135,44123,39423,4483,9255,31435,20335,58388,53680,36700,47864,12932,1824,22988,27752,59669,56497,33373,47097,16261,2593,21709,24937,65046,52146,38238,41210,10374,7458,17358,30314,62231,50867,39007,44539,9607,4131,20175,31595,47128,36284,54096,59124,28296,23340,1472,12388,46361,32957,56913,60405,25481,22061,2241,15717,41498,38846,51538,64758,29834,16686,8130,10854,44827,39615,50259,61943,31115,19503,4803,10087,35868,47544,59220,54e3,23180,28456,12740,1120,33053,46265,59989,57329,22413,25129,15557,2401,38430,41914,64854,51442,16526,29994,11206,7778,39711,44731,61527,50675,19855,30763,9927,4963]);function n(x=new Uint8Array,A=65535){F[0]=A;for(let E of x)F[0]=t[(F[0]^E)&255]^F[0]>>>8;return F[0]}export{n as default};