|
|
|
[公告]看雪论坛秋季版上线,欢迎反馈
还是上一版看贴方便, 主题能完整显示. 这版主题字太小,主题得鼠标移上去才能完整显示 |
|
[求助]看了那么长时间的RSA算法,仍然看不懂下面的这个代码
用中国剩余定理来解 from gmpy2 import * from binascii import * def chinese_remainder_theorem(items): M = 1 for a, m in items: M *= m result = 0 for a, m in items: Mi = M/m Mi_d=invert(Mi, m); result += a*Mi*Mi_d return result % M, M def solve(): m1 = 0xC1594232E0C82877C7FBCF8FA1FEC2FAE9EF9FF8A60C057B891EB3B27AC60F7CB12144FA5C08C8AC64867DE4CB94CEA44E20002F488E4BA9B328BAE420D7F861 a1 = 0x8EB59040D88360FEBCF0F2808E5C1DD3A6A5D7AEAE2C780E5662319DD807692A106AD93142A9C98FDEE52EE5A3F70273B642BD8DA0FCFBD50C54E0CA666D6F42 m2 = 0x8BE1C51518A608CD1A41D77418B3DF047017C9AEF2AF153AFC8112C68DD3F9924E6849B6FB38B887699F6687B166281D3B7C5F9E5A82582847558D11B07237A9 a2 = 0x17E5A0D31A661441265B4A2CACC205539646DF5EC9558B5D8A74A1B42B8647E7F9058228A37B19B01C5CBB513DD5C64B3EB90006308DC764A8B3404C7FA02E9A m3 = 0xDF343E4F83D0AE62E73BA0B6BC3342038E07961DFCA37906D89DE5E5B8BADCC84CAA438DD3FAE609A0E4F3931271E240CBEC62CCA95296776FEB0E92FEF7D671 a3 = 0x9AE829A0A5BA0E89F2626C5D3D2343F9F7DAAAEACB2487E19DAF81FE0C0B40C9F5AAD47C55257F671990D2B91D19EF3204C4EF973378550C5BB1C4CEDCE11E39 data = [] data.append([a1, m1]) data.append([a2, m2]) data.append([a3, m3]) x, n = chinese_remainder_theorem(data) print a2b_hex(hex(iroot(x, 3)[0])[2:]) return solve() >>> KEY{wgQzWssdsPdRVOo2e6j6}
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值