title: Large Exponents in Ruby?
body: <p>I'm just doing some University related Diffie-Hellman exercises and tried to use ruby for it.
  Sadly, ruby doesn't seem to be able to deal with large exponents:</p>
  <blockquote>
  <p>warning: in a**b, b may be too big<br />
  NaN<br />
  [...]</p>
  </blockquote>
  <p>Is there any way around it? (e.g. a special math class or something along that line?)</p>
  <p>p.s. here is the code in question:</p>
  <pre><code>generator = 7789
  prime = 1017473
  alice_secret = 415492
  bob_secret = 725193
  
  puts from_alice_to_bob = (generator**alice_secret) % prime
  puts from_bob_to_alice = (generator**bob_secret) % prime
  
  puts bobs_key_calculation = (from_alice_to_bob**bob_secret) % prime
  puts alices_key_calculation = (from_bob_to_alice**alice_secret) % prime
  </code></pre>