fletcher16.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Eistec AB
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef CHECKSUM_FLETCHER16_H
21 #define CHECKSUM_FLETCHER16_H
22 
23 #include <stdlib.h>
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 typedef struct {
34  uint16_t sum1;
35  uint16_t sum2;
37 
51 uint16_t fletcher16(const uint8_t *buf, size_t bytes);
52 
61 
69 void fletcher16_update(fletcher16_ctx_t *ctx, const uint8_t *data, size_t len);
70 
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* CHECKSUM_FLETCHER16_H */
85 
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:33
uint16_t sum2
Second sum of the checksum.
Definition: fletcher16.h:35
uint16_t sum1
First sum of the checksum.
Definition: fletcher16.h:34