edgeport - v1.0.3
    Preparing search index...

    Function crc16

    • Computes the CRC-16/XMODEM checksum NATS appends to every nkey.

      The polynomial is 0x1021 with a zero initial value; the result is stored little-endian as the last two bytes of a decoded nkey.

      Parameters

      • data: Uint8Array

        The bytes to checksum (prefix + payload, excluding the checksum itself).

      Returns number

      The 16-bit checksum.

      1.0.0

      import { crc16 } from 'edgeport/nats';
      const sum = crc16(new Uint8Array([1, 2, 3]));