UNPKG

@taichunmin/crc

Version:

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

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