/*
____ __ __ ____ _ _ _____ ___ _____ ____ _ _
( _ \( )( )(_ _)( \( )( _ )___ / __)( _ )(_ _)( \( )
)(_) ))(__)( _)(_ ) ( )(_)((___)( (__ )(_)( _)(_ ) (
(____/(______)(____)(_)\_)(_____) \___)(_____)(____)(_)\_)
Official code for Arduino boards (and relatives) version 4.3
Duino-Coin Team & Community 2019-2026 MIT Licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
If you don't know where to start, visit official website and navigate to
the Getting Started page. Have fun mining!
*/
/* For microcontrollers with low memory change that to -Os in all files,
for default settings use -O0. -O may be a good tradeoff between both */
#pragma GCC optimize ("-Ofast")
/* For microcontrollers with custom LED pins, adjust the line below */
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
#define SEP_TOKEN ","
#define END_TOKEN "\n"
/* For 8-bit microcontrollers we should use 16 bit variables since the
difficulty is low, for all the other cases should be 32 bits. */
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
typedef uint32_t uintDiff;
#else
typedef uint32_t uintDiff;
#endif
// Arduino identifier library - https://github.com/ricaun
#include "uniqueID.h"
#include "duco_hash.h"
String get_DUCOID() {
String ID = "DUCOID";
char buff[4];
for (size_t i = 0; i < 8; i++) {
sprintf(buff, "%02X", (uint8_t)UniqueID8[i]);
ID += buff;
}
return ID;
}
String DUCOID = "";
void setup() {
// Prepare built-in led pin as output
pinMode(LED_BUILTIN, OUTPUT);
DUCOID = get_DUCOID();
// Open serial port
Serial.begin(115200);
Serial.setTimeout(10000);
while (!Serial)
; // For Arduino Leonardo or any board with the ATmega32U4
Serial.flush();
}
void lowercase_hex_to_bytes(char const * hexDigest, uint8_t * rawDigest) {
for (uint8_t i = 0, j = 0; j < SHA1_HASH_LEN; i += 2, j += 1) {
uint8_t x = hexDigest[i];
uint8_t b = x >> 6;
uint8_t r = ((x & 0xf) | (b > 6;
rawDigest[j] = (r