UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 1.95 kB
"use strict";function t(A){let x=typeof A;return A!=null&&(x==="object"||x==="function")}function n(A,x,B){if(!t(A)||!Array.isArray(x)||x.length<1)return A;let E=A;for(let F of x.slice(0,-1))t(E[F])||(E[F]={}),E=E[F];return E[x.at(-1)]=B,A}var a=new Uint8Array(1),C=new Uint16Array(1),l=new Uint32Array(1);var f=new Uint16Array([0,7631,15262,9809,30524,27379,19618,20845,61048,62391,54758,51241,39236,33931,41690,48917,49471,56560,64161,59246,46595,43980,36253,36946,12103,12936,5337,2326,22651,17844,25573,32298,40881,33406,42031,47584,59533,62786,54035,52956,29129,27654,19031,22424,1781,6970,15723,8356,24206,17217,25872,30943,10674,13437,4652,4067,45302,44345,35688,38567,51146,55813,64596,57755,8877,16226,6451,1276,21905,18526,28175,29632,52437,53530,63307,60036,48105,42534,32887,40376,58258,65117,55308,50627,38062,35169,44848,45823,3562,4133,13940,11195,31446,26393,16712,23687,48412,41171,34434,39757,51744,55279,61886,60529,21348,20139,26874,30005,9304,14743,8134,521,31779,25068,18365,23154,2847,5840,12417,11598,37467,36756,43461,46090,58727,63656,57081,49974,17754,22677,32452,25355,12902,12201,2552,5175,43810,46829,37052,36211,56350,49617,59264,64079,33893,39338,49147,41524,62297,61078,51399,54536,27165,30674,20867,19532,7457,238,9919,15216,56043,50980,57717,64698,44503,45080,38473,35718,13459,10588,3853,4802,17327,24160,30769,26110,7124,1563,8266,15749,27880,28967,22390,19129,62892,59491,52786,54269,33424,40799,47374,42177,26615,31288,23657,16806,4299,3332,11093,13978,35215,37952,45585,45022,65203,58236,50477,55522,42696,47879,40278,32921,53748,52283,60010,63397,18608,21887,29486,28385,16268,8771,1042,6621,63558,58761,50136,56855,36730,37557,46308,43307,5694,3057,11680,12399,24834,31949,23196,18259,14713,9398,743,7976,20037,21386,30171,26644,55041,51918,60575,61776,41021,48626,39843,34412]);function r(A=new Uint8Array,x=0){C[0]=x^65535;for(let B of A)C[0]=f[C[0]>>>8^B]^C[0]<<8;return C[0]^65535}module.exports=r;