fletcher16.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Eistec AB
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #include <stdlib.h>
20 #include <stdint.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 typedef struct {
30  uint16_t sum1;
31  uint16_t sum2;
33 
47 uint16_t fletcher16(const uint8_t *buf, size_t bytes);
48 
57 
65 void fletcher16_update(fletcher16_ctx_t *ctx, const uint8_t *data, size_t len);
66 
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
uint16_t fletcher16(const uint8_t *buf, size_t bytes)
Fletcher's 16 bit checksum .
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.
void fletcher16_init(fletcher16_ctx_t *ctx)
Initialize a fletcher16 context.
Fletcher's 16 bit checksum context struct.
Definition: fletcher16.h:29
uint16_t sum2
Second sum of the checksum.
Definition: fletcher16.h:31
uint16_t sum1
First sum of the checksum.
Definition: fletcher16.h:30