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 
9 #pragma once
10 
23 #include <stdlib.h>
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 typedef struct {
34  uint32_t sum1;
35  uint32_t sum2;
37 
51 uint32_t fletcher32(const uint16_t *buf, size_t words);
52 
61 
73 void fletcher32_update(fletcher32_ctx_t *ctx, const void *data, size_t words);
74 
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
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:33
uint32_t sum2
Second sum of the checksum.
Definition: fletcher32.h:35
uint32_t sum1
First sum of the checksum.
Definition: fletcher32.h:34