Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InternetChecksum ¶
InternetChecksum computes the RFC 1071 internet checksum over data. It sums all 16-bit words, folds the carry bits, and returns the one's complement as uint64.
Types ¶
type ChecksumFunc ¶
ChecksumFunc is the signature for a checksum algorithm function. It takes a byte slice and returns a checksum value as uint64.
type ChecksumRegistry ¶
type ChecksumRegistry struct {
// contains filtered or unexported fields
}
ChecksumRegistry manages registered checksum algorithms.
func NewChecksumRegistry ¶
func NewChecksumRegistry() *ChecksumRegistry
NewChecksumRegistry creates a new empty ChecksumRegistry.
func NewDefaultChecksumRegistry ¶
func NewDefaultChecksumRegistry() *ChecksumRegistry
NewDefaultChecksumRegistry creates a ChecksumRegistry pre-loaded with all built-in checksum algorithms: internet-checksum, crc16, and crc32.
func (*ChecksumRegistry) Get ¶
func (r *ChecksumRegistry) Get(name string) (ChecksumFunc, error)
Get retrieves a checksum algorithm by name. Returns AlgorithmNotFoundError if the algorithm is not registered.
func (*ChecksumRegistry) Has ¶
func (r *ChecksumRegistry) Has(name string) bool
Has checks whether a checksum algorithm is registered.
func (*ChecksumRegistry) Register ¶
func (r *ChecksumRegistry) Register(name string, fn ChecksumFunc)
Register adds a checksum algorithm to the registry.