返回
1
0

wp

pixel_BC,2026-02-08 19:32

看到e是2的4次方就可以猜到是rabin密码体系,而且进行了四轮

Plaintext
from Crypto.Util.number import * def rabin_decrypt(c, p, q): results = [] n = p * q yp = inverse(p, q) yq = inverse(q, p) for c0 in c: mp = pow(c0, (p + 1) // 4, p) mq = pow(c0, (q + 1) // 4, q) r1 = (yp * p * mq + yq * q * mp) % n r2 = n - r1 r3 = (yp * p * mq - yq * q * mp) % n r4 = n - r3 results.extend([r1, r2, r3, r4]) return results c = 3708354049649318175189820619077599798890688075815858391284996256924308912935262733471980964003143534200740113874286537588889431819703343015872364443921848 p = 75000325607193724293694446403116223058337764961074929316352803137087536131383 q = 69376057129404174647351914434400429820318738947745593069596264646867332546443 c_list = [c] for i in range(4): c_list = rabin_decrypt(c_list, p, q) for res in c_list: print(long_to_bytes(res))
暂无回复。你的想法是什么?


bottom-logo1
bottom-logo2captionbottom-logo3
GeeSec
商务合作
bottom-logo4