UNPKG

crc

Version:

Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the browser.

11 lines (10 loc) 255 B
const crc1 = (current, previous = 0) => { let crc = ~~previous; let accum = 0; for (let index = 0; index < current.length; index++) { accum += current[index]; } crc += accum % 256; return crc % 256; }; export default crc1;