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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
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.