nickgammon / BigNumber

BigNumber library for the Arduino
MIT License
85 stars 22 forks source link

Convert to char array? #13

Closed EuphoriaCelestial closed 5 years ago

EuphoriaCelestial commented 5 years ago

I am trying to do the Diffie Hellman key exchange here. It require a very very large prime number, so I end up using this library. But then the key must be in char[] type. So is there any proper way to convert?

nickgammon commented 5 years ago

Yes, the toString function does that. For example:

// function to display a big number and free it afterwards
void printBignum (BigNumber & n)
{
  char * s = n.toString ();
  Serial.println (s);
  free (s);
}  // end of printBignum