import hashlib for i inrange(999999999999999): x=hashlib.md5() x.update(str(i).encode('utf-8')) des=x.hexdigest() if des[0:6]=='c4d038': print(i) break #114514
password=114514&e[v.a.l=var_dump(scandir('/')); –> flag password=114514&e[v.a.l=var_dump(exec('tac /fl?g'));
a='e9e3eee8f4f7bffdd0bebad0fcf6e2e2bcfbfdf6d0eee1ebd0eabbf5f6aeaeaeaeaeaef2' for i inrange(0,len(a),2): print(chr(int(a[i:i+2],16)^key),end='') #flag{x0r_15_symm3try_and_e4zy!!!!!!}
Vigenère
babyencoding
1 2 3
part 1 of flag: ZmxhZ3tkYXp6bGluZ19lbmNvZGluZyM0ZTBhZDQ= base64 part 2 of flag: MYYGGYJQHBSDCZJRMQYGMMJQMMYGGN3BMZSTIMRSMZSWCNY= base32 part 3 of flag: =8S4U,3DR8SDY,C`S-F5F-C(S,S<R-C`Q9F8S87T` uudecode
cf = [] while y: cf.append(x // y) x, y = y, x % y return cf
defgradualFra(cf): numerator = 0 denominator = 1 for x in cf[::-1]: # 这里的渐进分数分子分母要分开 numerator, denominator = denominator, x * denominator + numerator return numerator, denominator
defsolve_pq(a, b, c): par = gmpy2.isqrt(b * b - 4 * a * c) return (-b + par) // (2 * a), (-b - par) // (2 * a)
defgetGradualFra(cf): gf = [] for i inrange(1, len(cf) + 1): gf.append(gradualFra(cf[:i])) return gf
defwienerAttack(e, n): cf = continuedFra(e, n) gf = getGradualFra(cf) for d, k in gf: if k == 0: continue if (e * d - 1) % k != 0: continue phi = (e * d - 1) // k p, q = solve_pq(1, n - phi + 1, n) if p * q == n: return d
n = e = c = d = wienerAttack(e, n) m = pow(c, d, n) print(libnum.n2s(m))
babyrsa
n分解多个因数
yafu分解
1 2 3 4
p_list = [] phi= 1 for p in p_list: phi *= (p-1)
循环求欧拉函数就行
fence
Caesar’s Secert
brainfuck
Affine
1 2 3 4 5 6 7 8 9 10 11 12
from flag import flag, key
modulus = 256
ciphertext = []
for f in flag: ciphertext.append((key[0]*f + key[1]) % modulus) #
for a inrange(-200,200): for b inrange (-200,200): if (a*ord('f')+b)%256 == int('dd',16) and (a*ord('l')+b)%256 == int('43',16) and (a*ord('a')+b)%256 == int('88',16) and (a*ord('g')+b)%256 == int('ee',16): print(a,b)
a='dd4388ee428bdddd5865cc66aa5887ffcca966109c66edcca920667a88312064' for i inrange(0,len(a),2): print(chr(241*(int(a[i:i+2],16)-23)%256),end='') #17 23 #flag{4ff1ne_c1pher_i5_very_3azy}