c = 43104378128345818181217961835377190975779804452524643191544804229536124095677294719566215359919831933542699064892141754715180028183150724886016542388159082125737677224886528142312511700711365919689756090950704 # from https://blog.csdn.net/weixin_45791152/article/details/104522781 # or `s = fibonacci(1000)` in sage s = 43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
e = 65537 n = 88503001447845031603457048661635807319447136634748350130947825183012205093541 c = 40876621398366534035989065383910105526025410999058860023908252093679681817257
# from yafu p = 274539690398523616505159415195049044439 q = 322368694010594584041053487661458382819 assert p*q == n
phi = (p-1)*(q-1) d = invert(e, phi) m = pow(c, d, n) flag = libnum.n2s(int(m)) print(flag)
from gmpy2 import invert from functools import reduce import libnum
e = 65537 n = 175797137276517400024170861198192089021253920489351812147043687817076482376379806063372376015921 c = 144009221781172353636339988896910912047726260759108847257566019412382083853598735817869933202168
# from yafu ps = [ 9401433281508038261, 10252499084912054759, 11855687732085186571, 13716847112310466417, 11215197893925590897 ] phi = reduce(lambda x, y: (x)*(y-1), [1]+ps) d = invert(e, phi) m = pow(c, d, n) flag = libnum.n2s(int(m)) print(flag)
c = 'ac73a774a25bd512d543dc468542c9428141800dd041d043c918d112850dd515d6128214d1138211d71599' c = bytes.fromhex(c) # assume HSCTF{... ...} key = [c[0]^ord('H'), c[1]^ord('S')] flag = '' for i inrange(len(c)): flag += chr(c[i] ^ key[i%2]) print(flag)
# Part 2 M = matrix([ [1, a2], [0, b2] ]) L = M.LLL() w = L[0]
v = M.solve_left(w) # guess gcd(x2, y2) for g inrange(1, 10000): x2 = abs(v[0]) * g mx2 = libnum.n2s(int(x2)) yes = True for m in mx2: ifnotchr(m) in string.printable: yes = False break if yes: y2 = abs(v[1]) * g my2 = libnum.n2s(int(y2)) yes = True for m in my2: ifnotchr(m) in string.printable: yes = False break if yes: #print(x2, y2) break else: print('more gcd') exit(-1)
# get flag res = [x0, y0, x1, y1, x2, y2] res = [libnum.n2s(int(x)) for x in res] flag = '' for r in res: for m in r: flag += chr(m) print(flag)