crc32
Constants
- crc_table :
Uint32Array
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)).
- crc32(buffer, [offset], [length]) ⇒
number
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
| Param | Type | Description |
|---|---|---|
| input_crc | number | starting CRC value |
| buffer | Uint8Array | |
| offset | number | |
| length | number |
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
| Param | Type | Default | Description |
|---|---|---|---|
| buffer | Uint8Array | byte buffer | |
| [offset] | number | 0 | where to start in the input buffer |
| [length] | number | buffer.length | how 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);