Skip to main content

crc32

Constants

Functions

Update a running CRC with the bytes buf[0..len-1]--the CRC should be initialized to all 1's, and the transmitted value is the 1's complement of the final running CRC (see the crc32() routine below)).

32-bit Cyclic Redundancy Checksum.

crc_table : Uint32Array

Kind: global constant

update_crc(input_crc, buffer, offset, length) ⇒ number

Update a running CRC with the bytes buf[0..len-1]--the CRC should be initialized to all 1's, and the transmitted value is the 1's complement of the final running CRC (see the crc32() routine below)).

Kind: global function

ParamTypeDescription
input_crcnumberstarting CRC value
bufferUint8Array
offsetnumber
lengthnumber

crc32(buffer, [offset], [length]) ⇒ number

32-bit Cyclic Redundancy Checksum.

Kind: global function
Returns: number - Unsigned 32-bit integer value
See: https://en.wikipedia.org/wiki/Cyclic_redundancy_check
Copyright: Company Named Limited (c) 2025

ParamTypeDefaultDescription
bufferUint8Arraybyte buffer
[offset]number0where to start in the input buffer
[length]numberbuffer.lengthhow many bytes to include in checksum calculation

Example

const buffer = new BinaryBuffer();
buffer.writeASCIIString("Hello World");
const checksum = crc32(buffer.raw_bytes, 0, buffer.position);