gmp_pow()将不接受指数的GMP编号 [英] gmp_pow() will not accept a GMP number for exponent

查看:199
本文介绍了gmp_pow()将不接受指数的GMP编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP中玩RSA和大数字。我需要能够使用gmp_pow()数字到具有〜256到〜512字节的指数的幂。

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?

推荐答案

您应该使用gmp_powm(),它会自动将中间值减小到小于模值。这正是你想要的RSA。

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()不接受大于一个长的指数,因为中间值将大于计算机中的可寻址内存。

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.

这篇关于gmp_pow()将不接受指数的GMP编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆