The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
checksum.c File Reference

the Internet checksum (see checksum.h). More...

#include "checksum.h"

Functions

uint32_t checksum_add (uint32_t sum, const void *data, uint32_t length)
 add bytes to a partial sum.
uint16_t checksum_finish (uint32_t sum)
 fold a partial sum and complement it: the checksum to store.
uint16_t checksum (const void *data, uint32_t length)
 the checksum of one buffer.

Detailed Description

the Internet checksum (see checksum.h).

Function Documentation

◆ checksum_add()

uint32_t checksum_add ( uint32_t sum,
const void * data,
uint32_t length )

add bytes to a partial sum.

an odd length pads with a zero byte, so only the last piece of a checksum may have an odd length.

◆ checksum_finish()

uint16_t checksum_finish ( uint32_t sum)

fold a partial sum and complement it: the checksum to store.

◆ checksum()

uint16_t checksum ( const void * data,
uint32_t length )

the checksum of one buffer.