fletcher32.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 
20 #include <stdlib.h>
21 #include <stdint.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
30 typedef struct {
31  uint32_t sum1;
32  uint32_t sum2;
34 
48 uint32_t fletcher32(const uint16_t *buf, size_t words);
49 
58 
70 void fletcher32_update(fletcher32_ctx_t *ctx, const void *data, size_t words);
71 
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
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:30
uint32_t sum2
Second sum of the checksum.
Definition: fletcher32.h:32
uint32_t sum1
First sum of the checksum.
Definition: fletcher32.h:31