I am trying to do some RSA encryption and decryption for one of my classes. If you have looked at RSA encryption you know that it envolves rasing numbers to large powers (6^23 in the first problem I am doing). The answer that these exponents yeild will be too large for any standard var. in C++ (I am using Visual C++ .net).
My professor told me that if I wanted to wirte a C++ program to handle a certain portion of the encryption process then I would have to use bignum.h. I have found this library and I think I am using it right. The problem is when I go to print my answer, which is a Bignum variable, I cannot seem to do so with standard print functions.
I was wondering if anyone had any idea on how I can print this variable. Here is the code that I have written:
The cout statement that is commented out will give me an error if I try to use it. Otherwise the program will compile and run just fine. Any ideas on how I can print the Bignum answer variable?
My professor told me that if I wanted to wirte a C++ program to handle a certain portion of the encryption process then I would have to use bignum.h. I have found this library and I think I am using it right. The problem is when I go to print my answer, which is a Bignum variable, I cannot seem to do so with standard print functions.
I was wondering if anyone had any idea on how I can print this variable. Here is the code that I have written:
Code:
#include "Bignum.h"
#include <iostream>
#include <cmath>
#include <stdio.h>
void main ()
{
Bignum answer;
int base = 6;
int exp = 17;
int divisor = 21;
double c;
c = pow(base,exp);
answer = fmod(c, divisor);
//cout << answer;
return;
}
The cout statement that is commented out will give me an error if I try to use it. Otherwise the program will compile and run just fine. Any ideas on how I can print the Bignum answer variable?