Hello everyone!

I'd have a bigger problem with RSA realization in PHP. I've been given two primes each 250digits long. The problem isn't to multiply theo ne with the other, because it takes less than 0.05sec but the problems begins where I need to raise the one to the power of the other. There I get always 1 result. I've searched RSA classes on the net and actually I found one but that's still with only 9digit long primes.
Is there any way to realize RSA encoding with 250digit long primesπŸ˜•

Thanks for responses!

    I'm not familiar with RSA, but are you talking about 250-digit base 10 numbers? If so, raising one of them to the power of another is a HUGE number. A much smaller example using 3-digit numbers gives you just a glimpse of the scope: 100 ^ 200 equals 1 followed by 400 zeros. Imagine what 1000000000000000000 ^ 200000000000000000000 would equal, and those are only 20-digit-long numbers. (It's probably a number bigger than the number of atoms in the universe or some such unimaginably large amount.)

    Even if what you actually mean is 250 bit numbers, just the 40-bit binary number 1000000000000000000000000000000000000000 equals 549,755,813,888 decimal, which raised to a power of another similarly sized number will still give you an unimaginably, astronomically large result.

      sorry I misunderstood the generation :queasy: The problem isn't the power raising, it's to find relative prim to those number's multiplied result. I'll sit on it for some time and I hope will find a good algorythm to create relative prime.

        NogDog wrote:

        If so, raising one of them to the power of another is a HUGE number.

        The trick is that RSA does not require you to raise a number to some exponent. Rather, it requires you to raise a number to some exponent, modulo some other number, upon which more efficient algorithms are available than just computing the power and then computing the modulo.

        frost2k9 wrote:

        The problem isn't the power raising, it's to find relative prim to those number's multiplied result.

        Admittedly, I have never attempted an implementation myself (using existing libraries seem both easier and safer to me), but long time ago I chanced upon this page on The Mathematical Guts of RSA Encryption, and it may help you.

          Thanks a lot! Actually I could do it so now I have a fully usable RSA-1024 coder/decoder. πŸ™‚ Actually Decoding takes some time so I say it's for offline, but the coder is fast. I tested with a 30pages long text file and it took 30seconds to print out the encoded form. πŸ†’

            Write a Reply...