Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Modular Multiplication

  1. Dec 29, 2006 #1
    I want to write a C/C++ program and encounter a problem.If I have three 64 bit numbers and need to manipulate
    "a * b mod c"

    Is there any well-known, efficient and simple algorithm to implement it?

    I only know it can be calculated sth. like this..
    __int64 a, b, c
    a = x1 * 2^32 + x0
    b = y1 * 2^32 + y0

    then a * b = x1y1 * 2^64 + (x0y1 + x1y0) * 2^32 + x0y0

    but I dunno what to do in the next step

    Note that this cannot be calculated using some classes like BigInt, gmp

    Thank you very much!!!
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Modular Multiplication
  1. Modular Inverses? (Replies: 8)

  2. Modular arithmetic (Replies: 5)

  3. Modular Mathematics (Replies: 4)

  4. Modular arithmetic (Replies: 7)

Loading...