Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ handling very large integers
    text
    copied!<p>I am using the RSA Algorithm for encryption/decryption, and in order to decrypt the files you have to deal with some pretty big values. More specifically, things like </p> <pre><code>P = C^d % n = 62^65 % 133 </code></pre> <p>Now that is really the only calculations that ill be doing. I have tried using Matt McCutchen's BigInteger Library, but I am getting a lot of compiler errors during linking, such as:</p> <pre><code>encryption.o(.text+0x187):encryption.cpp: undefined reference to `BigInteger::BigInteger(int)' encryption.o(.text+0x302):encryption.cpp: undefined reference to `operator&lt;&lt;(std::ostream&amp;, BigInteger const&amp;)' encryption.o(.text$_ZNK10BigIntegermlERKS_[BigInteger::operator*(BigInteger const&amp;) const]+0x63):encryption.cpp: undefined reference to `BigInteger::multiply(BigInteger const&amp;, BigInteger const&amp;)' </code></pre> <p>So I was wondering what would be the best way to go about handling the really big integers that come out of the RSA Algorithm.</p> <p>I heard that a possibility would be to declare your variables as a double long, so...</p> <pre><code>long long decryptedCharacter; </code></pre> <p>but I'm not sure exactly how big of an integer that can store.</p> <hr> <p>Well for example, I try to compile and run the following program using dev C++:</p> <pre><code>#include iostream #include "bigint\BigIntegerLibrary.hh" using namespace std; int main() { BigInteger a = 65536; cout &lt;&lt; (a * a * a * a * a * a * a * a); return 0; } </code></pre> <p>then I get those errors.</p> <p>Derek, I thought that by including the <code>BigIntegerLibrary.hh</code> file, that the compiler would go through and compile all the necessary files that it will use.</p> <p>How should I try and compile the program above in order to resolve the linking errors?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload