Convert arbitrary size strings to arbitrary precision integers (bigints)
I'm trying to implement the Solovoy-Strassen primitiveness test for massive large integers. I will also be writing bignum (can't use a third party implementation as this is an academic project). I have defined the following structure for bignum:
struct {
uint64_t *tab;
int size; // number of limbs
int sign;
}
I will use base-32 for my digits (hence uint64_t, for partial products, at least I assume they will be partial products). This decision was based on the previous question.
I froze. I cannot imagine how one could take a string represented as a decimal size of an arbitrary size and convert it to the bignum structure above.
Can someone please enlighten me. Even a small example would be nice, such as converting a possibly arbitrary string to octal digits to be stored in the uint16_t array.
Thanks.
+2
a source to share