Manuscript Documentation
v2026.12.0

@std/data/checksum.ms#

Import each required symbol with import Name from "@std/data/checksum.ms".

Adler32 Type#

An RFC 1950 Adler-32 checksum built from ordered chunks, retaining no input bytes. var sum = Adler32() then sum.update("Wikipedia".to_bytes()) gives sum.value() = 300286872. Reading the value does not reset it; create a new Adler32 to start over.

Manuscript
type Adler32 {
    state UInt32 = 1
}

Adler32.state#

Accumulator state, initially the empty checksum. Use update() to append data.

Manuscript
state UInt32 = 1

Adler32.update#

Appends these bytes to the checksum; an empty chunk leaves it unchanged.

Manuscript
var fn update(data Bytes) Void

Adler32.value#

Returns the current checksum without resetting or otherwise changing it.

Manuscript
fn value() UInt32

Crc32 Type#

An IEEE CRC-32 checksum built from ordered chunks, retaining no input bytes. var sum = Crc32() then sum.update("123456789".to_bytes()) gives sum.value() = 3421780262. Reading the value does not reset it; create a new Crc32 to start over.

Manuscript
type Crc32 {
    state UInt32 = 0
}

Crc32.state#

Accumulator state, initially the empty checksum. Use update() to append data.

Manuscript
state UInt32 = 0

Crc32.update#

Appends these bytes to the checksum; an empty chunk leaves it unchanged.

Manuscript
var fn update(data Bytes) Void

Crc32.value#

Returns the current checksum without resetting or otherwise changing it.

Manuscript
fn value() UInt32

adler32 Function#

Computes the RFC 1950 Adler-32 checksum used by zlib. Empty input returns one. Starting with a = 1 and b = 0, adds each byte to a and each a to b, modulo 65521; the result is b * 65536 + a. Reads the input without copying it. adler32("Wikipedia".to_bytes()) returns 300286872 (0x11E60398).

Manuscript
fn adler32(data Bytes) UInt32 { ... }

adler32_of Function#

Reads input to the end and returns the Adler-32 of all its bytes, as adler32 does for bytes in hand. Retains no input bytes, and consumes and closes the stream. A failed read returns its error.

Manuscript
fn adler32_of(move input ReadStream[Bytes]) Result[UInt32, Error] { ... }

crc32 Function#

Computes CRC-32/ISO-HDLC (IEEE, as used by ZIP and gzip) as an unsigned 32-bit value. Uses polynomial 0x04C11DB7 (reflected 0xEDB88320), reflected input/output, initial register 0xFFFFFFFF and final XOR 0xFFFFFFFF. Empty input returns zero. Reads the input without copying it. Detects accidental corruption only; it does not authenticate data. crc32("123456789".to_bytes()) returns 3421780262 (0xCBF43926).

Manuscript
fn crc32(data Bytes) UInt32 { ... }

crc32_of Function#

Reads input to the end and returns the CRC-32 of all its bytes, as crc32 does for bytes in hand. Retains no input bytes, and consumes and closes the stream. A failed read returns its error.

Manuscript
fn crc32_of(move input ReadStream[Bytes]) Result[UInt32, Error] { ... }