RSA computing c ^ d mod n


In the RSA Encryption Algorithm, how would one calculate c^d mod n when c and d are large numbers?

GMP is a C/C++ software library that does this for you: mpz_powm, mpz_powm_ui in the documentation. The method used is (largely) explained in the wikipedia page and you could try to read the source code for GMP, if you feel up to that...