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.
0x1021
The bytes to checksum (prefix + payload, excluding the checksum itself).
The 16-bit checksum.
1.0.0
import { crc16 } from 'edgeport/nats';const sum = crc16(new Uint8Array([1, 2, 3])); Copy
import { crc16 } from 'edgeport/nats';const sum = crc16(new Uint8Array([1, 2, 3]));
Computes the CRC-16/XMODEM checksum NATS appends to every nkey.
The polynomial is
0x1021with a zero initial value; the result is stored little-endian as the last two bytes of a decoded nkey.