src/zcrc.js
function crc16(octet_nums) {
        var crc = octet_nums[0];
        for (var b=1; b<octet_nums.length; b++) {
            crc = _updcrc( octet_nums[b], crc );
        }

        crc = _updcrc( 0, _updcrc(0, crc) );

        //a big-endian 2-byte sequence
        return Zmodem.ENCODELIB.pack_u16_be(crc);
    }
function crc16(octet_nums) {
        var crc = octet_nums[0];
        for (var b=1; b<octet_nums.length; b++) {
            crc = _updcrc( octet_nums[b], crc );
        }

        crc = _updcrc( 0, _updcrc(0, crc) );

        //a big-endian 2-byte sequence
        return Zmodem.ENCODELIB.pack_u16_be(crc);
    }
function crc16 ( octet_nums ) { var crc = octet_nums [ 0 ] ; for ( var b = 1 ; b < octet_nums . length ; b ++ ) { crc = _updcrc ( octet_nums [ b ] , crc ) ; } crc = _updcrc ( 0 , _updcrc ( 0 , crc ) ) ; //a big-endian 2-byte sequence return Zmodem . ENCODELIB . pack_u16_be ( crc ) ; }
https://www.lammertbies.nl/comm/info/crc-calculation.html CRC-CCITT (XModem) 
Deduce a given set of octet values’ CRC16, as per the CRC16
variant that ZMODEM uses (CRC-CCITT/XModem).

@param {Array} octets - The array of octet values.
Each array member should be an 8-bit unsigned integer (0-255).

@returns {Array} crc - The CRC, expressed as an array of octet values.
https : // www . lammertbies . nl / comm / info / crc - calculation . html CRC - CCITT ( XModem ) Deduce a given set of octet values’ CRC16 as per the CRC16 variant that ZMODEM uses ( CRC - CCITT / XModem ) .