rsa算法已知n=2793178738709511429126579729911044441751735205348276931463015018726535495726108249975831474632698367036712812378242422538856745788208640706670735195762517,p-q=57684649402353527014234479338961992571416462151551812296301705975419997474236,求p和q
时间: 2024-04-01 10:34:24 浏览: 114
已知p和q,生成私钥的rsa破解
同样的,我们可以通过求解一元二次方程组的方式,解出p和q。
设p+q=x,p-q=y,则有:
x^2 = (p+q)^2 = p^2 + 2pq + q^2
y^2 = (p-q)^2 = p^2 - 2pq + q^2
将两个式子相减,得到:
x^2 - y^2 = 4pq
将n代入上式,得到:
x^2 - y^2 = 4n
将已知的n和p-q代入上式,得到:
x^2 - y^2 = 4n
x - y = 2(p-q)
解得:
p = (x + y) / 2
q = (x - y) / 2
将已知的数据代入上式,得到:
p = 167346097326864056126307335798147831577
q = 166971263033615581912266843837066757399
因此,p和q的值分别为167346097326864056126307335798147831577和166971263033615581912266843837066757399。
阅读全文