Currently trying to understand cryptography by myself. There is a task of forging El Gamal signature
p=541, g=2, h=419 and are public keys.
I need to find a, which is a private key.
The only info I found so far is that the whole task is somehow related to the discrete logarithms.
If p-1 has a decent number of prime divisors, it can be done relatively fast, using the chinese remainder theorm and a bit of tricks. I ran a program that hunted down these sorts of numbers for every prime under two million.
In essence, we note that 540 = 2*2*3*3*3*5, and proceed from there.
We've added 2^6 to h, and found that the nineth power of this is 411 = 129^2. This means that h+6 = 18, mod 27, and thus h = 12, mod 27
We scroll through the powers of 48 until we get a match, but h mod 5 = 1.
So, modulo(4, 27, 5), we seek (2,12,1).
216-960+810 = 66
This particular algorim is considerably fast when p-1 has a large number of small divisors.