#include <Crypto.h>
#include <Curve25519.h>
#include <RNG.h>
struct Key
{
uint8_t pub[32];
uint8_t prvt[32];
uint8_t sk[32];
}key;
const char hexMap[] PROGMEM = "0123456789abcdef";
// String hash(uint8_t a[])
// {
// return "";
// }
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
//RNG.begin("TestCurve25519 1.0");
}
int cnt=0;
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
cnt++;
Curve25519::dh1(key.pub, key.prvt);
//hash(key.pub);
String pu, pr;
for(int i=0; i<32; i++)
{
pu += ((char)pgm_read_byte(hexMap + (key.pub[i] >> 4)));
pu += ((char)pgm_read_byte(hexMap + (key.pub[i] & 0xf)));
pr += ((char)pgm_read_byte(hexMap + (key.prvt[i] >> 4)));
pr += ((char)pgm_read_byte(hexMap + (key.prvt[i] & 0xf)));
}
Serial.print("Prtvate Key ");
Serial.print(cnt);
Serial.print(": ");
Serial.println(pr);
Serial.print("Public Key ");
Serial.print(cnt);
Serial.print(" : ");
Serial.println(pu);
Serial.println();
Serial.println();
}