Loading...
Searching...
No Matches
Fletcher16

Fletcher16 checksum algorithm. More...

Detailed Description

Fletcher16 checksum algorithm.

Files

file  fletcher16.h
 

Data Structures

struct  fletcher16_ctx_t
 Fletcher's 16 bit checksum context struct. More...
 

Functions

uint16_t fletcher16 (const uint8_t *buf, size_t bytes)
 Fletcher's 16 bit checksum .
 
void fletcher16_init (fletcher16_ctx_t *ctx)
 Initialize a fletcher16 context.
 
void fletcher16_update (fletcher16_ctx_t *ctx, const uint8_t *data, size_t len)
 Update the fletcher16 context with new data.
 
uint16_t fletcher16_finish (fletcher16_ctx_t *ctx)
 Finalize the checksum operation and return the checksum.
 

Function Documentation

◆ fletcher16()

uint16_t fletcher16 ( const uint8_t *  buf,
size_t  bytes 
)

Fletcher's 16 bit checksum .

found on http://en.wikipedia.org/w/index.php?title=Fletcher%27s_checksum&oldid=661273016#Optimizations

Note
the returned sum is never 0
Parameters
bufinput buffer to hash
byteslength of buffer, in bytes
Returns
16 bit sized hash in the interval [1..65535]

◆ fletcher16_finish()

uint16_t fletcher16_finish ( fletcher16_ctx_t ctx)

Finalize the checksum operation and return the checksum.

Parameters
[in]ctxfletcher16 context
Returns
Checksum of the data

◆ fletcher16_init()

void fletcher16_init ( fletcher16_ctx_t ctx)

Initialize a fletcher16 context.

Multi-part version of fletcher16_full.

Parameters
[in]ctxfletcher16 context to initialize

◆ fletcher16_update()

void fletcher16_update ( fletcher16_ctx_t ctx,
const uint8_t *  data,
size_t  len 
)

Update the fletcher16 context with new data.

Parameters
[in]ctxfletcher16 context
[in]dataData to add to the context
[in]lenLength of the data