@taichunmin/crc
Version:
A cross platform alternative for calculating Cyclic Redundancy Checks (CRC) values.
2 lines (1 loc) • 1.98 kB
JavaScript
;(()=>{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 n=new Uint16Array([0,51303,22697,37070,45394,31029,59899,8604,43715,25252,62058,14861,7057,54262,17208,35679,40417,21894,50504,3375,11443,58580,29722,48253,14114,65349,28555,42988,34416,19991,57049,5822,62373,15298,43788,25451,17143,35472,6750,53817,22886,37121,463,51624,59444,8275,45213,30970,28228,42531,14061,65162,57110,6001,34751,20440,50311,3296,39982,21577,30165,48562,11644,58651,12077,59210,30596,49123,40575,22040,50902,3761,34286,19849,56647,5408,13500,64731,27669,42098,45772,31403,60005,8706,926,52217,23351,37712,6159,53352,16550,35009,43357,24890,61940,14739,56456,5359,33825,19526,28122,42429,13683,64788,30283,48684,12002,59013,50969,3966,40880,22487,16745,35086,6592,53671,61499,14428,43154,24821,60330,9165,45827,31588,23288,37535,593,51766,24154,38461,1779,52884,61192,10095,47009,32710,62617,15614,44080,25687,17867,36268,7522,54533,50107,3036,39698,21365,29417,47758,10816,57895,27e3,41247,12753,63926,55338,4173,32899,18660,44543,26008,62806,15665,7341,54474,17412,35939,1852,53083,24469,38898,46702,32265,61127,9888,12318,63609,26807,41168,33100,18731,55781,4482,39645,21178,49780,2579,11151,58344,29478,47937,29047,47376,10718,57785,49189,2114,39052,20715,56244,5075,33565,19322,27366,41601,12879,64040,60566,9457,46143,31832,24004,38307,1389,52490,18005,36402,7932,54939,63239,16224,44974,26569,33490,19125,55931,4636,13184,64487,27433,41806,10257,57462,28856,47327,39235,20772,49642,2445,7987,55124,18330,36861,44641,26118,63176,16047,46576,32151,60761,9534,1186,52421,23563,37996]);function t(x=new Uint8Array,A=65535){F[0]=A;for(let E of x)F[0]=n[F[0]>>>8^E]^F[0]<<8;return F[0]}r(globalThis,["taichunmin","crc","crc16cdma2000"],t);})();