UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 2 kB
"use strict";(()=>{function D(x){let F=typeof x;return x!=null&&(F==="object"||F==="function")}function n(x,F,E){if(!D(x)||!Array.isArray(F)||F.length<1)return x;let B=x;for(let C of F.slice(0,-1))D(B[C])||(B[C]={}),B=B[C];return B[F.at(-1)]=E,x}var o=new Uint8Array(1),A=new Uint16Array(1),c=new Uint32Array(1);var e=new Uint16Array([0,13918,27836,23266,55672,61222,46532,33690,65417,51671,37685,42347,9969,4271,19021,31763,45675,33845,57047,59529,27411,23885,1967,12785,19938,31676,8542,5888,38042,41668,63526,52856,10671,8177,17683,29517,61655,50825,40043,43573,54822,57464,47770,36036,3934,14592,25570,21948,39876,44442,63352,49446,17084,29922,11776,6238,25677,21011,2289,16047,48437,35691,53641,59351,21342,25856,16354,2492,35366,48248,59034,53444,44247,39561,49259,63029,30127,17393,6419,12109,57653,55147,36233,48087,14413,3603,21745,25263,7868,10466,29184,17502,51140,61850,43896,40230,31473,19631,5709,8211,41865,38359,53045,63851,34168,45862,59844,57242,23552,27230,12476,1762,51354,65220,42022,37496,4578,10172,32094,19200,14099,333,23471,28145,61035,55349,33495,46217,42684,37090,51712,64606,32708,18842,4984,9510,22837,28523,13705,983,32845,46611,60657,55983,5335,8841,30827,20021,52655,64497,41235,38733,60254,56576,34786,45500,12838,1144,24218,26820,36627,47437,58287,54769,22123,24629,15063,3209,28826,18116,7206,10872,43490,40892,50526,62208,15736,2854,20932,26522,58368,53854,35004,48866,49905,62639,44621,38931,7049,11735,30517,16747,62946,50108,39262,44800,11418,6852,16422,30328,2667,15413,26327,20617,54035,58701,49071,35313,18313,29143,11061,7531,40689,43183,62029,50195,47104,36446,54460,58082,24952,22310,3524,15258,56397,59923,45297,34479,1333,13163,27017,24535,9156,5530,20344,31014,64188,52450,38400,41054,28198,22648,666,13508,46942,33024,56290,60860,37295,42993,64787,52045,18647,32393,9323,4661]),t=65535;function r(x=new Uint8Array,F=65535){A[0]=F^t;for(let E of x)A[0]=e[(A[0]^E)&255]^A[0]>>>8;return A[0]^t}n(globalThis,["taichunmin","crc","crc16dnp"],r);})();