fletcher32.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 
21 #ifndef CHECKSUM_FLETCHER32_H
22 #define CHECKSUM_FLETCHER32_H
23 
24 #include <stdlib.h>
25 #include <stdint.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 typedef struct {
35  uint32_t sum1;
36  uint32_t sum2;
38 
52 uint32_t fletcher32(const uint16_t *buf, size_t words);
53 
62 
74 void fletcher32_update(fletcher32_ctx_t *ctx, const void *data, size_t words);
75 
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* CHECKSUM_FLETCHER32_H */
90 
uint32_t fletcher32_finish(fletcher32_ctx_t *ctx)
Finalize the checksum operation and return the checksum.
void fletcher32_init(fletcher32_ctx_t *ctx)
Initialize a fletcher32 context.
uint32_t fletcher32(const uint16_t *buf, size_t words)
Fletcher's 32 bit checksum.
void fletcher32_update(fletcher32_ctx_t *ctx, const void *data, size_t words)
Incrementally update the fletcher32 context with new data.
Fletcher's 32 bit checksum context struct.
Definition: fletcher32.h:34
uint32_t sum2
Second sum of the checksum.
Definition: fletcher32.h:36
uint32_t sum1
First sum of the checksum.
Definition: fletcher32.h:35