Dev Helpers

Node.js / Compression

Checksum bytes with CRC32

Dev Helpers · October 30, 2026

CRC32 is useful for detecting accidental changes to a byte sequence. Record the input encoding so different producers compute the same checksum.

Worked example

import * as z from "node:zlib";
const data = Buffer.from("sample sample sample");
console.log(z.crc32(data).toString(16));

Result

f552df35

Implementation notes

Keep checksums and cryptographic authentication separate in the design. A checksum meant for transfer diagnostics does not authenticate a sender.

Try it yourself

Compare the bytes of a line with and without its trailing newline.

Open the Node.js example →

Editorial date October 30, 2026 · Published December 6, 2026

Related articles

Safely parse malformed input

Parsing user-provided JSON needs a failure path. Successful parsing alone does not establish that the result has the expected shape.

Attach details to a mark

Performance marks can carry details about the operation they describe. Small stable identifiers are easier to aggregate than large payloads.

Capture positional arguments

Process arguments include runtime and entry-point information before user arguments. Slice off those positions before interpreting input.