python中pow_如何在python中找到pow(a,b,c)的反向?

当已知b、c和pow(a, b, c)的结果res时,要找到a的值,可以将问题转化为RSA问题。通过计算z=b-1 mod λ(c),然后用x = yz mod c求解,其中λ是Carmichael的lambda函数或Euler的phi函数。如果c易于因式分解,可以直接计算;否则,这可能是个难题。提供的代码展示了这些步骤,包括计算逆元和Carmichael函数。" 110223451,9465013,SpringBoot整合Mybatis与PageHelper:配置Druid与实战,"['SpringBoot', 'Mybatis', '数据库连接池', '分页助手', 'Druid']
摘要由CSDN通过智能技术生成

1586010002-jmsa.png

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值