Ascii, rsa and bignum

Continuing on the track of the previous question about ASCII, I'm using each_byte to change a string to ASCII for the purpose of encrypting it, using the theory of the RSA algorithm ( to see if I can! ). Part of this algorithm requires getting a power ( a**b ) in which the "a" is the ASCII value of the string and the "b" is some large number that is dictated by the RSA algorithm ( about 25,000,000,000,000 for my test string ). However, when I do this I get the error

NaN
test_ascii.rbw:20: warning: in a**b, b may be too big

While I could simulate a power with a loop, doing this 25 trillion times might take a little while. I could also simulate the power with logs, but I'm sure that this would add inaccuracies and the integral number has to be exact. Is there a way out or is this just a fundamental limitation of Bignums in Ruby?
Barry

It's a limitation of our universe; there isn't enough matter to store
numbers that large.

Instead, look at the algorithm a little more closely and I'm sure you'll
find that you only need some of the bits out of this humungo number.
Generally, the algorithm is specified in such a way that you can get
just what you need.

If it isn't clear in what you're working from, check out MathWorld or
Knuth's books (IIRC) for hints. And remember, google is your friend.

-- MarkusQ

···

On Fri, 2004-08-27 at 14:07, Barry Sperling wrote:

Continuing on the track of the previous question about ASCII, I'm using
each_byte to change a string to ASCII for the purpose of encrypting it,
using the theory of the RSA algorithm ( to see if I can! ). Part of
this algorithm requires getting a power ( a**b ) in which the "a" is the
ASCII value of the string and the "b" is some large number that is
dictated by the RSA algorithm ( about 25,000,000,000,000 for my test
string ). However, when I do this I get the error

NaN
test_ascii.rbw:20: warning: in a**b, b may be too big

While I could simulate a power with a loop, doing this 25 trillion times
might take a little while. I could also simulate the power with logs,
but I'm sure that this would add inaccuracies and the integral number
has to be exact. Is there a way out or is this just a fundamental
limitation of Bignums in Ruby?
Barry