nupp.checksum.spi

Implementation interfaces for nupp.checksum algorithm catalogs.

The facade chooses the unique highest priority during module initialization. Importing this declaration does not load storage or algorithms. A provider supplies an algorithms map keyed by canonical algorithm name. Each descriptor's name agrees with its key, and each create returns independent owned state. The chosen catalog replaces matching built-in algorithms and may add names; other built-in algorithms remain available. Empty discovery uses the built-in catalog. Discovery order never selects a provider.

The facade validates and retains descriptors while requiring the module. Lookup, listing, and context creation then use cached descriptors without SPI resolution. Provider state processes chunks incrementally and retains neither input nor output spans. Cleanup consumes state without suspension. Reuse these canonical State and Algorithm identities, including ownership and borrowing signatures. value returns a non-consuming uint64 snapshot; width specifies its meaningful bits from 1 through 64. Standard names retain their standard widths and exact CRC parameters. Checksums detect corruption and provide no authentication.

Module contents

Types

TypeKindDescription
AlgorithminterfaceImmutable algorithm identity, output metadata, and a factory for fresh state.
ProviderinterfaceA selectable implementation catalog.
StateinterfaceIndependent incremental state; close consumes its ownership without suspension.

Types#

Algorithminterface#

interface Algorithm ...

Immutable algorithm identity, output metadata, and a factory for fresh state.

Members

NameKindDescription
namefieldCanonical algorithm name, matching the catalog map key.
widthfieldNumber of meaningful checksum bits.
createmethodCreates independent owned state; self is the retained descriptor.

namefield#

name: string
@readonly

Canonical algorithm name, matching the catalog map key.

widthfield#

width: integer
@readonly

Number of meaningful checksum bits.

createmethod#

create: function(self: Algorithm): State

Creates independent owned state; self is the retained descriptor.

Arguments
NameTypeDescription
selfAlgorithm
Returns
TypeDescription
State

Providerinterface#

interface Provider ...

A selectable implementation catalog. Extra descriptor members are permitted.

Members

NameKindDescription
priorityfield
algorithmsfieldCanonical names mapped to checked, independent-state factories.

priorityfield#

priority: integer?
@readonly

algorithmsfield#

algorithms: {[string]: Algorithm}
@readonly

Canonical names mapped to checked, independent-state factories.

Stateinterface#

interface State is nupp.Closeable ...

Independent incremental state; close consumes its ownership without suspension.

Members

NameKindDescription
closemethodReleases all state resources.
updatemethodProcesses this borrowed chunk without retaining its bytes.
valuemethodReturns the current unsigned checksum without consuming state.

closemethod#

close: @nosuspend function(takes self: State): nil

Releases all state resources.

Arguments
NameTypeDescription
takes selfState
Returns
TypeDescription
nil

updatemethod#

update: function(exclusive self: State, borrows bytes: ByteSpan): nil

Processes this borrowed chunk without retaining its bytes.

Arguments
NameTypeDescription
exclusive selfState
borrows bytesByteSpan
Returns
TypeDescription
nil

valuemethod#

value: function(self: State): uint64

Returns the current unsigned checksum without consuming state.

Arguments
NameTypeDescription
selfState
Returns
TypeDescription
uint64