UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 3.18 kB
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),c=new Uint16Array(1),F=new Uint32Array(1);var n=new Uint32Array([0,2425422081,2434859521,28312320,2453734401,47187200,56624640,2482046721,2491484161,68159744,94374400,2503019265,113249280,2521894145,2548108801,124784384,2566983681,160436480,136319488,2561741569,188748800,2614170881,2590053889,183506688,226498560,2635143425,2627803649,204479232,2680232961,256908544,249568768,2658213633,2181111809,311435520,320872960,2209424129,272638976,2161190145,2170627585,300951296,377497600,2249271553,2275486209,389032704,2227252225,340798720,367013376,2238787329,452997120,2341548289,2317431297,447755008,2302751745,433075456,408958464,2297509633,2407610369,521156864,513817088,2385591041,499137536,2370911489,2363571713,477118208,3019980801,613433600,622871040,3048293121,641745920,3067168001,3076605441,670058240,545277952,2953922817,2980137473,556813056,2999012353,575687936,601902592,3010547457,754995200,3180417281,3156300289,749753088,3208729601,802182400,778065408,3203487489,3112261633,688937216,681597440,3090242305,734026752,3142671617,3135331841,712007424,905994240,2794545409,2803982849,934306560,2755748865,886072576,895510016,2784061185,2726389761,839936256,866150912,2737924865,817916928,2689690881,2715905537,829452032,2936107009,1066430720,1042313728,2930864897,1027634176,2916185345,2892068353,1022392064,998275072,2870049025,2862709249,976255744,2848029697,961576192,954236416,2826010369,3623976961,1217429760,1226867200,3652289281,1245742080,3671164161,3680601601,1274054400,1283491840,3692136705,3718351361,1295026944,3737226241,1313901824,1340116480,3748761345,1090555904,3515977985,3491860993,1085313792,3544290305,1137743104,1113626112,3539048193,3582040065,1158715648,1151375872,3560020737,1203805184,3612450049,3605110273,1181785856,1509990400,3398541569,3407979009,1538302720,3359745025,1490068736,1499506176,3388057345,3464603649,1578150144,1604364800,3476138753,1556130816,3427904769,3454119425,1567665920,3271667713,1401991424,1377874432,3266425601,1363194880,3251746049,3227629057,1357952768,1468053504,3339827457,3332487681,1446034176,3317808129,1431354624,1424014848,3295788801,1811988480,4237410561,4246848001,1840300800,4265722881,1859175680,1868613120,4294035201,4169254913,1745930496,1772145152,4180790017,1791020032,4199664897,4225879553,1802555136,4110536705,1703989504,1679872512,4105294593,1732301824,4157723905,4133606913,1727059712,1635833856,4044478721,4037138945,1613814528,4089568257,1666243840,1658904064,4067548929,3993100289,2123424e3,2132861440,4021412609,2084627456,3973178625,3982616065,2112939776,2055268352,3927042305,3953256961,2066803456,3905022977,2018569472,2044784128,3916558081,1996550144,3885101313,3860984321,1991308032,3846304769,1976628480,1952511488,3841062657,3816945665,1930492160,1923152384,3794926337,1908472832,3780246785,3772907009,1886453504]);function t(x=new Uint8Array,A=0){F[0]=A;for(let E of x)F[0]=n[(F[0]^E)&255]^F[0]>>>8;return F[0]}export{t as default};