UNPKG

@taichunmin/crc

Version:

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

2 lines (1 loc) 1.92 kB
"use strict";function r(F){let x=typeof F;return F!=null&&(x==="object"||x==="function")}function t(F,x,B){if(!r(F)||!Array.isArray(x)||x.length<1)return F;let E=F;for(let A of x.slice(0,-1))r(E[A])||(E[A]={}),E=E[A];return E[x.at(-1)]=B,F}var b=new Uint8Array(1),C=new Uint16Array(1),l=new Uint32Array(1);var y=new Uint16Array([0,15717,31434,18351,62868,51441,36702,45627,54861,60200,44167,37346,9177,7868,22803,25718,37375,44186,60213,54864,25707,22798,7841,9156,18354,31447,15736,29,45606,36675,51436,62857,7835,9214,25681,22836,60175,54890,37317,44192,51414,62899,45596,36729,15682,39,18312,31469,36708,45569,62894,51403,31472,18325,58,15711,22825,25676,9187,7814,44221,37336,54903,60178,15670,83,18428,31385,51362,62919,45672,36621,60283,54814,37297,44244,7919,9098,25637,22848,44233,37292,54787,60262,22877,25656,9111,7922,31364,18401,78,15659,36624,45685,62938,51391,9133,7880,22887,25602,54841,60252,44275,37270,62944,51333,36650,45647,116,15633,31422,18395,45650,36663,51352,62973,18374,31395,15628,105,25631,22906,7893,9136,37259,44270,60225,54820,31340,18185,166,15811,36856,45725,62770,51287,44065,37188,55019,60302,22965,25808,9087,7706,60307,55030,37209,44092,7687,9058,25805,22952,15838,187,18196,31345,51274,62767,45696,36837,25847,22930,7741,9048,37219,44038,60329,54988,45754,36831,51312,62741,18222,31307,15844,129,62728,51309,36802,45735,156,15865,31318,18227,9029,7712,22927,25834,54993,60340,44059,37246,18266,31295,15760,245,45774,36779,51204,62817,37143,44146,60381,54968,25731,23014,7753,9004,54949,60352,44143,37130,9009,7764,23035,25758,232,15757,31266,18247,62844,51225,36790,45779,22977,25764,8971,7790,44117,37168,54943,60410,36748,45801,62790,51235,31256,18301,210,15799,51262,62811,45812,36753,15786,207,18272,31237,7795,8982,25785,23004,60391,54914,37165,44104]);function n(F=new Uint8Array,x=65535){C[0]=x^65535;for(let B of F)C[0]=y[C[0]>>>8^B]^C[0]<<8;return C[0]^65535}module.exports=n;