Modular Exponentiation - in Programming Languages

In Programming Languages

Because modular exponentiation is an important operation in computer science, and there are efficient algorithms (see above) that are much faster than simply exponentiating and then taking the remainder, many programming languages and arbitrary-precision integer libraries have a dedicated function to perform modular exponentiation:

  • Python's built-in pow (exponentiation) function takes an optional third argument which is the number to modulo by
  • Java's java.math.BigInteger class has a modPow method to perform modular exponentiation
  • Perl's Math::BigInt module has a bmodpow method to perform modular exponentiation
  • Go's big.Int type contains an Exp (exponentiation) method whose third parameter, if non-nil, is the number to modulo by
  • PHP's BC Math library has a bcpowmod function to perform modular exponentiation
  • The GNU Multiple Precision Arithmetic Library (GMP) library contains a mpz_powm function to perform modular exponentiation
  • Custom Function @PowerMod for FileMaker Pro (with 1024-bit RSA encryption example)

Read more about this topic:  Modular Exponentiation

Famous quotes containing the words programming and/or languages:

    If there is a price to pay for the privilege of spending the early years of child rearing in the driver’s seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.
    Melinda M. Marshall (20th century)

    The less sophisticated of my forbears avoided foreigners at all costs, for the very good reason that, in their circles, speaking in tongues was commonly a prelude to snake handling. The more tolerant among us regarded foreign languages as a kind of speech impediment that could be overcome by willpower.
    Barbara Ehrenreich (b. 1941)