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 r(F){let x=typeof F;return F!=null&&(x==="object"||x==="function")}function t(F,x,B){if(!r(F)||!Array.isArray(x)||x.length<1)return F;let E=F;for(let A of x.slice(0,-1))r(E[A])||(E[A]={}),E=E[A];return E[x.at(-1)]=B,F}var b=new Uint8Array(1),C=new Uint16Array(1),l=new Uint32Array(1);var y=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]);function n(F=new Uint8Array,x=65535){C[0]=x^65535;for(let B of F)C[0]=y[(C[0]^B)&255]^C[0]>>>8;return C[0]^65535}module.exports=n;