ietf-openpgp
[Top] [All Lists]

Re: Power function PGP math library?

2005-06-17 00:08:31

Kimmo Mäkeläinen said:
v = (((g)^u1 * (y^u2) mod p) mod q

I'm using PGP math library in calculation. The problem is how to calculate
parameter v.

The parameters g (power to u1) and y (power to u2) should be calculated
first and then these factors should be calculated together and so on. But
there isn't a function in the math library to calculate powers. The
calculation could be done with mp_mult, but it is very slow way to do it.

Basic modular math:

(g^u1 * y^u2) mod p == ( ((g^u1)mod p) * ((y^u2) mod p) ) mod p

you do not really want to calculate g^u1 or y^u2 since it will be a Really
Big Number [tm].


     Konrad




<Prev in Thread] Current Thread [Next in Thread>