mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
36 lines
880 B
C
36 lines
880 B
C
#pragma once
|
|
//
|
|
// FILE: Adler.h
|
|
// AUTHOR: Rob Tillaart
|
|
// VERSION: 0.2.4
|
|
// DATE: 2022-01-27
|
|
// PURPOSE: Arduino Library for calculating Adler checksum
|
|
// URL: https://github.com/RobTillaart/Adler
|
|
// https://en.wikipedia.org/wiki/Adler-32
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
#define ADLER_LIB_VERSION (F("0.2.4"))
|
|
|
|
|
|
const uint32_t ADLER32_MOD_PRIME = 65521;
|
|
const uint16_t ADLER16_MOD_PRIME = 251;
|
|
|
|
|
|
/////////////////////////////////////////////////
|
|
//
|
|
// STATIC FUNCTIONS
|
|
//
|
|
uint32_t adler32(uint8_t *data, uint16_t length, uint32_t s1 = 1, uint32_t s2 = 0);
|
|
uint16_t adler16(uint8_t *data, uint16_t length, uint16_t s1 = 1, uint16_t s2 = 0);
|
|
|
|
|
|
// char array wrappers
|
|
uint32_t adler32(char * array, uint16_t length, uint32_t s1 = 1, uint32_t s2 = 0);
|
|
uint16_t adler16(char * array, uint16_t length, uint16_t s1 = 1, uint16_t s2 = 0);
|
|
|
|
// -- END OF FILE --
|
|
|