RSA: Do I need to use a big int package for this?

Hello

I am teaching myself encryption using C.

At the moment I'm implementing RSA. I'm only using prime numbers smaller than 1000.

When it comes to encrypting, and especially decrypting, I'm getting some pretty massive numbers.

For example:

If I encrypt the number 6 using the key pair (79, 1121):

(6 ^ 79) mod 1121 = 693

I then decrypt using the key pair (859, 1121):

(693 ^ 859) mod 1121... Error. My compiler doesn't like 693 ^ 859. The number is too big.

Is there a smart way around this, or do I need to install a big int package?

Note I am already using long doubles.

Any help greatly appreciated.

Thank you.