2022-01-27 06:18:16 -05:00
|
|
|
//
|
|
|
|
// FILE: Adler_test.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo
|
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
#include "Adler.h"
|
|
|
|
|
|
|
|
|
|
|
|
// expected output
|
2022-06-16 03:46:28 -04:00
|
|
|
// ADLER_LIB_VERSION: 0.2.0
|
|
|
|
//
|
|
|
|
// E1F5
|
|
|
|
// 4660
|
|
|
|
// 4634
|
|
|
|
// 40A7
|
|
|
|
//
|
2022-01-27 06:18:16 -05:00
|
|
|
// 5C801F0
|
|
|
|
// 81E0256
|
|
|
|
// E000325
|
|
|
|
// 11E60398
|
|
|
|
|
|
|
|
|
2022-06-16 03:46:28 -04:00
|
|
|
|
2022-01-27 06:18:16 -05:00
|
|
|
char str1[24] = "abcde";
|
|
|
|
char str2[24] = "abcdef";
|
|
|
|
char str3[24] = "abcdefgh";
|
|
|
|
char str4[24] = "Wikipedia"; // example from Wikipedia page.
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
while (!Serial);
|
|
|
|
|
|
|
|
Serial.println();
|
2022-06-16 03:46:28 -04:00
|
|
|
Serial.print("ADLER_LIB_VERSION: ");
|
|
|
|
Serial.println(ADLER_LIB_VERSION);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
Serial.println(adler16((uint8_t *) str1, 5), HEX);
|
|
|
|
Serial.println(adler16((uint8_t *) str2, 6), HEX);
|
|
|
|
Serial.println(adler16((uint8_t *) str3, 8), HEX);
|
|
|
|
Serial.println(adler16((uint8_t *) str4, 9), HEX);
|
|
|
|
Serial.println();
|
2022-01-27 06:18:16 -05:00
|
|
|
|
|
|
|
Serial.println(adler32((uint8_t *) str1, 5), HEX);
|
|
|
|
Serial.println(adler32((uint8_t *) str2, 6), HEX);
|
|
|
|
Serial.println(adler32((uint8_t *) str3, 8), HEX);
|
|
|
|
Serial.println(adler32((uint8_t *) str4, 9), HEX);
|
2022-06-16 03:46:28 -04:00
|
|
|
Serial.println();
|
2022-01-27 06:18:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -- END OF FILE --
|