gmp_pow() will not accept a GMP number for exponen

2019-08-28 15:01发布

I am playing around in PHP with RSA and big numbers. I need to be able to take numbers to the power of an exponent that has ~256 to ~512 bytes using gmp_pow(). Does anyone have any suggestions?

1条回答
唯我独甜
2楼-- · 2019-08-28 15:47

You should use gmp_powm() which automatically reduces the intermediate values to be less than the modulus value. This exactly what you want for RSA.

gmp_pow() doesn't accept an exponent large than a long since the intermediate values will be larger than the addressable memory in your computer.

查看更多
登录 后发表回答