#include <Arduino.h>
// Forward declaration of the assembly function
extern "C" void bigint_mul256(uint8_t *result, const uint8_t *a, const uint8_t *b);
void setup()
{
Serial.begin(9600);
Serial.println();
Serial.print("Big Integer Multiplication Test\n");
//uint8_t a[32] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//uint8_t b[32] = {0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t a[32] = {0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//uint8_t b[32] = {0x94, 0x98, 0xDC, 0x4F, 0xB4, 0xC5, 0xD4, 0x95, 0x84, 0x72, 0xAA, 0xA6, 0x81, 0x02, 0x50, 0x85, 0x84, 0xCB, 0x25, 0x41, 0xFC, 0xAA, 0xCC, 0x47, 0xD6, 0x29, 0x3B, 0x9F, 0x41, 0xCF, 0x3F, 0x35};
uint8_t b[32] = {0x53, 0x9C, 0xBC, 0xDC, 0x0F, 0xD1, 0x9B, 0x2A, 0xBC, 0x77, 0x37, 0x9F, 0xD9, 0xDA, 0x51, 0x14, 0x4F, 0xBD, 0xA8, 0xB6, 0x13, 0xF6, 0xD3, 0xA4, 0xBD, 0x66, 0xB9, 0x28, 0x22, 0xE2, 0xC4, 0x3D};
//uint8_t result[64] = {0};
volatile uint8_t result[64] = {0};
Serial.print(" a = ");
for (int i = 0; i < 32; i++)
{
Serial.print(a[i], HEX);
Serial.print(" ");
}
Serial.println();
Serial.print(" b = ");
for (int i = 0; i < 32; i++)
{
Serial.print(b[i], HEX);
Serial.print(" ");
}
Serial.println();
//delay(10);
// Call the assembly function to multiply the big integers
bigint_mul256(result, a, b);
// Print the result
Serial.print(" result = ");
for (int i = 0; i < 64; i++)
{
Serial.print(result[i], HEX);
Serial.print(" ");
}
Serial.println();
}
void loop()
{
// Empty loop
}