php fmod()与POW()一起使用时返回错误的值
因此,我试图执行一个应该加密文本的公共私钥方程
= m^e mod n,
其中m是需要加密的,我尝试了很多不同的事物,并且它们都没有工作,但它们都可以
pow(20,37)%77;
返回0
fmod(pow(20,37), 77);
返回33返回33
20^37%77;
返回49我的最接近的是48的正确答案,
我似乎无法弄清楚什么是错误的,我认为这可能是一个浮点问题,但是当在JavaScript中执行相同的方程式和C#时,
如果有人可以帮助我, 它可以很好地解决它。或至少让我走上正确的轨道,这将不胜感激:)
So im trying to do a public private key equation which should be
Encrypted text = m^e mod n
where m is what needs to be encrypted ive tried alot of different things and none of them work
pow(20,37)%77;
this returns 0
fmod(pow(20,37), 77);
this returns 33
20^37%77;
this returns 49 which is the closests ive gotten to the correct answer of 48
i cant seem to figure out what is going wrong im assuming it might be a floating point issue but when doing this same equation in javascript and c# it works out perfect
if anyone could help me out or atleast get me on the right track that would be greatly appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论