UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 3.24 kB
"use strict";(()=>{function D(x){let F=typeof x;return x!=null&&(F==="object"||F==="function")}function r(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 e=new Uint8Array(1),o=new Uint16Array(1),A=new Uint32Array(1);var n=new Uint32Array([0,2526397642,4215814601,1843264771,552846287,3060139781,3686529542,1294876364,1105692574,3614589780,3132079703,742029981,1628718161,4152459419,2589752728,214546770,2211385148,358271990,2022127349,3994219071,2738670835,900270137,1484059962,3470864880,3257436322,1421692008,962638187,2952099233,3806022509,1951305639,429093540,2399581806,3523063333,1198025455,716543980,3156235046,4044254698,1738254624,172381219,2631110889,2417633723,110095729,1800540274,4257731768,2968119924,645672638,1268896701,3711178615,1379049753,3299304915,2843384016,1072651290,1925276374,3830752796,2307480351,521969621,332736135,2235621965,3902611278,2114509700,858187080,2779980162,3362708609,1593514059,1972956183,3809290461,2396050910,407179540,1433087960,3288263442,2921534993,951505627,880765833,2733289283,3476509248,1503827594,344762438,2182704268,4022636943,2035373381,4132954923,1623336929,220191458,2609520168,3601080548,1077011502,770447661,3145326055,3081790645,556114047,1291345276,3664615862,2537793402,30827440,1812700851,4204681849,2758099506,854623992,1596816379,3384327985,2224456189,302204215,2145302580,3914038526,3850552748,1930887526,516619365,2287941807,3312518755,1407500969,1043939242,2829908832,665472270,2973731268,3705828551,1249357837,123309761,2446084619,4229019400,1787065282,1716374160,4040691290,2634412889,194000787,1186859359,3492531605,3187028118,727970908,3945912366,2107907300,276423143,2263622957,3418495969,1566039851,814359080,2787108578,2866175920,1011063674,1369335417,3339428531,2317720703,481319093,1903011254,3891814780,1761531666,4268430296,2478239451,86190609,1208816861,3734556695,3007655188,634448350,689524876,3213661254,3528550725,1153740175,166368067,2675922825,4070746762,1681354304,986478091,2891559617,3246673858,1460767496,440382916,2359980302,3782708237,2011318471,2066477461,3988665695,2154023004,385223830,1540895322,3444438672,2693794707,906350425,3104012599,798408189,1112228094,3571352628,2582690552,258309682,1656259377,4096608251,4175756969,1852914275,61654880,2503541674,3625401702,1317206444,593429679,3049963621,2661889081,138211571,1709247984,4084517178,3193632758,684667708,1158860351,3548842741,3746476967,1239119725,604408430,2995998372,4290605160,1764275362,83184033,2455801195,493239045,2348023759,3861775052,1891354118,1033238730,2868919296,3336421635,1346897353,1552006299,3390339153,2815001938,828129688,2087878484,3941055390,2268743325,296714839,1330944540,3653328598,3021775829,579430175,1873238483,4180843801,2498715674,41592016,246619522,2552682824,4126876747,1668210817,776003149,3100973703,3574130564,1134371662,3432748320,1510887914,936619241,2705745955,3966260975,2063438373,388001574,2176166892,2373718718,468309620,1983130487,3768709053,2911883633,991565243,1455941816,3226610802]);function t(x=new Uint8Array,F=4294967295){A[0]=F;for(let E of x)A[0]=n[(A[0]^E)&255]^A[0]>>>8;return A[0]}r(globalThis,["taichunmin","crc","crc32mef"],t);})();