checksum

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2025 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package checksum provides the implementation of the encoding and decoding of network protocol headers.

Index

Constants

View Source
const Size = 2

Size is the size of a checksum.

The checksum is held in a uint16 which is 2 bytes.

Variables

This section is empty.

Functions

func Checksum

func Checksum(buf []byte, initial uint16) uint16

func ChecksumDefault

func ChecksumDefault(buf []byte, initial uint16) uint16

func Combine

func Combine(a, b uint16) uint16

Combine combines the two uint16 to form their checksum. This is done by adding them and the carry.

Note that checksum a must have been computed on an even number of bytes.

func Put

func Put(b []byte, xsum uint16)

Put puts the checksum in the provided byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL