UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 1.94 kB
"use strict";function t(A){let x=typeof A;return A!=null&&(x==="object"||x==="function")}function n(A,x,E){if(!t(A)||!Array.isArray(x)||x.length<1)return A;let C=A;for(let B of x.slice(0,-1))t(C[B])||(C[B]={}),C=C[B];return C[x.at(-1)]=E,A}var b=new Uint8Array(1),D=new Uint16Array(1),l=new Uint32Array(1);var y=new Uint16Array([0,1417,2834,3739,5668,5037,7478,6335,11336,10689,10074,8915,14956,16357,12670,13559,22672,23833,21378,22027,20148,19261,17830,16431,29912,29009,32714,31299,25340,26485,27118,27751,45344,46249,47666,49083,42756,41613,44054,43423,40296,39137,38522,37875,35660,36549,32862,34263,59824,60473,58018,59179,65428,64029,62598,61711,50680,49265,52970,52067,54236,54869,55502,56647,26569,25152,27867,26962,29165,29796,31487,32630,19329,19976,16531,17690,23973,22572,22199,21310,16217,15056,13387,12738,10621,11508,8815,10214,4881,5784,6147,7562,1333,188,3623,2990,55017,54112,56827,55410,49357,50500,52191,52822,64161,65320,61875,62522,60549,59660,59287,57886,36473,35824,34155,32994,39005,40404,37711,38598,41521,42936,43299,44202,46101,45468,48903,47758,53138,51739,50304,49417,55734,56383,53924,55085,58330,58963,59592,60737,62974,61559,65260,64357,38658,37515,39952,39321,33062,33967,35380,36797,47946,48835,45144,46545,44398,43239,42620,41973,32434,31547,30112,28713,26774,27935,25476,26125,21242,22387,23016,23649,17630,16727,20428,19013,9762,9131,11568,10425,12294,13711,15124,16029,2666,4067,376,1265,7246,6599,5980,4821,43099,44498,41801,42688,48767,48118,46445,45284,33811,33178,36609,35464,37431,38846,39205,40108,61643,62786,64473,65104,59119,58214,60925,59508,56451,55562,55185,53784,51879,53038,49589,50236,6523,7410,4713,6112,3935,2774,1101,452,13619,12474,15905,15272,8983,9886,10245,11660,16875,17506,19193,20336,22479,21062,23773,22868,28067,26666,26289,25400,31623,32270,28821,29980]);function r(A=new Uint8Array,x=1){D[0]=x^1;for(let E of A)D[0]=y[D[0]>>>8^E]^D[0]<<8;return D[0]^1}module.exports=r;