python中pow

发布时间:2024-11-11 18:13

pow(a,b,c) operator in python returns (a**b)%c . If I have values of b, c, and the result of this operation (res=pow(a,b,c)), how can I find the value of a?

解决方案

Despite the statements in the comments this is not the discrete logarithm problem. This more closely resembles the RSA problem in which c is the product of two large primes, b is the encrypt exponent, and a is the unknown plaintext. I always like to make x the unknown variable you want to solve for, so you have y= xb mod c where y, b, and c are known, you want to solve for x. Solving it involves the same basic number theory as in RSA, namely you must compute z=b-1 mod λ(c), and then you can solve for x via x = yz mod c. λ is Carmichael's lambda function, but you can also use Euler's phi (totient) function instead. We have reduced the original problem to computing an inv

网址:python中pow https://www.yuejiaxmz.com/news/view/36076

相关内容

Python中if
Python中的遇到的错误(持续更新)
Python的生活小技巧
省时省力,这些Python高效代码片段必须牢记
高效时间管理:Python编程助力职场与家庭生活平衡之道
基于python的膳食健康推荐系统
Python编程实现ChatGPT智能冰箱食谱生成与烹饪控制
Python实现简单算法乘法:提升编程效率与逻辑思维
python+flask计算机毕业设计个人时间管理APP(程序+开题+论文)
Python实现经典还钱问题算法:优化财务管理的编程技巧

随便看看