UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 1.93 kB
"use strict";function t(A){let x=typeof A;return A!=null&&(x==="object"||x==="function")}function n(A,x,E){if(!t(A)||!Array.isArray(x)||x.length<1)return A;let C=A;for(let B of x.slice(0,-1))t(C[B])||(C[B]={}),C=C[B];return C[x.at(-1)]=E,A}var b=new Uint8Array(1),D=new Uint16Array(1),l=new Uint32Array(1);var y=new Uint16Array([0,28515,57030,45477,53999,48524,3113,25418,51901,42462,5243,31512,6226,30513,50836,43511,64025,38266,9439,19388,10486,18325,63024,39251,12452,24519,61026,33025,57931,36136,15501,21486,39761,62514,17815,10996,18878,9949,38776,63515,20972,16015,36650,57417,33539,60512,24005,12966,24904,3627,49038,53485,45991,56516,28001,514,44021,50326,30003,6736,31002,5753,42972,51391,22977,13986,34567,59492,35630,58445,21992,14987,37756,64543,19898,8921,16787,12016,40789,61494,41944,52411,32030,4733,28983,7764,45041,49298,26981,1542,47011,55488,48010,54505,25932,2607,49808,44531,7254,29493,4223,32540,52921,41434,2093,26446,55019,47496,56002,46497,1028,27495,14473,22506,58959,35116,60006,34053,13472,23491,62004,40279,11506,17297,8411,20408,65053,37246,45954,56545,27972,551,24941,3598,49067,53448,31039,5724,43001,51354,43984,50355,29974,6773,18843,9976,38749,63550,39796,62487,17842,10961,33574,60485,24032,12931,20937,16042,36623,57452,10451,18352,62997,39286,64060,38239,9466,19353,57966,36109,15528,21451,12417,24546,60999,33060,53962,48553,3084,25455,37,28486,57059,45440,6263,30484,50865,43474,51864,42491,5214,31549,59971,34080,13445,23526,14508,22479,58986,35081,8446,20381,65080,37211,61969,40306,11479,17332,4186,32569,52892,41471,49845,44502,7283,29456,56039,46468,1057,27458,2056,26475,54990,47533,28946,7793,45012,49335,41981,52382,32059,4696,48047,54476,25961,2570,26944,1571,46982,55525,35595,58472,21965,15022,23012,13959,34594,59457,16822,11989,40816,61459,37721,64570,19871,8956]);function r(A=new Uint8Array,x=0){D[0]=x;for(let E of A)D[0]=y[D[0]>>>8^E]^D[0]<<8;return D[0]}module.exports=r;