defexgcd(a, b):# 扩展欧几里得算法,求ua+vb=gcd(a,b)中的u,v if b == 0: u, v = 1, 0 return (u, v) if a < b: a, b = b, a u, v = exgcd(b, a%b) u, v = v, u - a // b * v return (u, v)
u, v = exgcd(e1, e2) print(u, v) m = gmpy2.powmod(c1, u, n) * gmpy2.powmod(c2, v, n) % n print(long_to_bytes(m))
得到 flag : flag{49d91077a1abcb14f1a9d546c80be9ef}
世上无难事
题目给了一串字符: VIZZB IFIUOJBWO NVXAP OBC XZZ UKHVN IFIUOJBWO HB XVIXW XAW VXFI X QIXN VBD KQ IFIUOJBWO WBKAH NBWXO VBD XJBCN NKG QLKEIU DI XUI VIUI DKNV QNCWIANQ XN DXPIMKIZW VKHV QEVBBZ KA XUZKAHNBA FKUHKAKX XAW DI VXFI HBN QNCWIANQ NCAKAH KA MUBG XZZ XEUBQQ XGIUKEX MUBG PKAWIUHXUNIA NVUBCHV 12NV HUXWI XAW DI XUI SCQN QB HZXW NVXN XZZ EBCZW SBKA CQ NBWXO XAW DI DXAN NB NVXAP DXPIMKIZW MBU JIKAH QCEV XA BCNQNXAWKAH VBQN HKFI OBCUQIZFIQ X JKH UBCAW BM XLLZXCQI XAW NVI PIO KQ 640I11012805M211J0XJ24MM02X1IW09 不知道是什么,猜想为替换密码,尝试爆破:https://quipqiup.com/ 得到结果: flag 为 640E11012805F211B0AB24FF02A1ED09 再将大写字母替换成小写字母:
1 2 3 4 5 6 7 8 9 10
key = '640E11012805F211B0AB24FF02A1ED09' flag = ''
for i inrange(len(key)):
iford('A') <= ord(key[i]) <= ord('Z'): flag += chr(ord(key[i]) - ord('A') + ord('a')) else: flag += key[i] print(flag)