Loading...
Searching...
No Matches
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
9#pragma once
10
21
22#include <stdlib.h>
23#include <stdint.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32typedef struct {
33 uint16_t sum1;
34 uint16_t sum2;
36
50uint16_t fletcher16(const uint8_t *buf, size_t bytes);
51
60
68void fletcher16_update(fletcher16_ctx_t *ctx, const uint8_t *data, size_t len);
69
78
79#ifdef __cplusplus
80}
81#endif
82
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:32
uint16_t sum2
Second sum of the checksum.
Definition fletcher16.h:34
uint16_t sum1
First sum of the checksum.
Definition fletcher16.h:33