UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 1.35 kB
"use strict";function e(r){let x=typeof r;return r!=null&&(x==="object"||x==="function")}function C(r,x,n){if(!e(r)||!Array.isArray(x)||x.length<1)return r;let A=r;for(let t of x.slice(0,-1))e(A[t])||(A[t]={}),A=A[t];return A[x.at(-1)]=n,r}var F=new Uint8Array(1),b=new Uint16Array(1),l=new Uint32Array(1);var a=new Uint8Array([0,47,94,113,188,147,226,205,87,120,9,38,235,196,181,154,174,129,240,223,18,61,76,99,249,214,167,136,69,106,27,52,115,92,45,2,207,224,145,190,36,11,122,85,152,183,198,233,221,242,131,172,97,78,63,16,138,165,212,251,54,25,104,71,230,201,184,151,90,117,4,43,177,158,239,192,13,34,83,124,72,103,22,57,244,219,170,133,31,48,65,110,163,140,253,210,149,186,203,228,41,6,119,88,194,237,156,179,126,81,32,15,59,20,101,74,135,168,217,246,108,67,50,29,208,255,142,161,227,204,189,146,95,112,1,46,180,155,234,197,8,39,86,121,77,98,19,60,241,222,175,128,26,53,68,107,166,137,248,215,144,191,206,225,44,3,114,93,199,232,153,182,123,84,37,10,62,17,96,79,130,173,220,243,105,70,55,24,213,250,139,164,5,42,91,116,185,150,231,200,82,125,12,35,238,193,176,159,171,132,245,218,23,56,73,102,252,211,162,141,64,111,30,49,118,89,40,7,202,229,148,187,33,14,127,80,157,178,195,236,216,247,134,169,100,75,58,21,143,160,209,254,51,28,109,66]);function E(r=new Uint8Array,x=0){F[0]=x^255;for(let n of r)F[0]=a[F[0]^n];return F[0]^255}module.exports=E;