2022-01-26 04:24:06 -05:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: Fletcher.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2022-11-07 08:21:36 -05:00
|
|
|
// VERSION: 0.1.7
|
2022-01-26 04:24:06 -05:00
|
|
|
// DATE: 2022-01-25
|
|
|
|
// PURPOSE: Arduino Library for calculating Fletcher's checksum
|
2022-01-26 10:34:57 -05:00
|
|
|
// URL: https://github.com/RobTillaart/Fletcher
|
|
|
|
// https://en.wikipedia.org/wiki/Fletcher%27s_checksum
|
2022-01-26 04:24:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
|
2022-11-07 08:21:36 -05:00
|
|
|
#define FLETCHER_LIB_VERSION (F("0.1.7"))
|
2022-01-26 04:24:06 -05:00
|
|
|
|
|
|
|
#define FLETCHER_16 255
|
|
|
|
#define FLETCHER_32 65535UL
|
|
|
|
#define FLETCHER_64 4294967295ULL
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// straightforward implementation.
|
|
|
|
// max length buffer 65534.
|
|
|
|
// Wikipedia shows optimizations.
|
|
|
|
//
|
2022-04-15 11:36:01 -04:00
|
|
|
uint16_t fletcher16(uint8_t *data, uint16_t length);
|
2022-01-26 04:24:06 -05:00
|
|
|
|
2022-04-15 11:36:01 -04:00
|
|
|
uint32_t fletcher32(uint16_t *data, uint16_t length);
|
2022-01-26 04:24:06 -05:00
|
|
|
|
2022-04-15 11:36:01 -04:00
|
|
|
uint64_t fletcher64(uint32_t *data, uint16_t length);
|
2022-01-26 04:24:06 -05:00
|
|
|
|
|
|
|
|
2022-04-15 11:36:01 -04:00
|
|
|
// -- END OF FILE --
|
2022-01-26 04:24:06 -05:00
|
|
|
|