Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sage.all_cmdline import *
- from sage.all import *
- from extern_module import *
- import os,time
- from Crypto.Util import number
- start = time.time()
- DIR = os.path.dirname(os.path.realpath(__file__))
- f = open(f'{DIR}/dump.txt','rb')# collect 65537 pair c-n
- m_list,c_list = [],[]
- for line in f.read().split(b'\n')[:-1]:
- (n,c) = [int(i) for i in line.split(b':::')]
- m_list.append(n)
- c_list.append(c)
- # m_list = [n1,n2,n3]
- # c_list = [c1,c2,c3]
- f.close()
- print("TAG")
- # dump = crt(c_list,m_list)
- # f = open(f'{DIR}/result.txt','wb')
- # f.write(str(dump).encode());f.close()
- ## => crt pair same bit_length faster than sequence crt
- e = 65537
- step = 12
- while len(m_list)!=1:
- print("LOOP")
- newC,newN = [],[]
- for i in range(0, len(m_list), step):
- RESULT = Integer(crt(c_list[i:i+step], m_list[i:i+step]))
- # if RESULT==0:continue
- prod = 1
- for _m in m_list[i:i+step]:prod *= _m
- newC.append(RESULT)
- newN.append(Integer(prod))
- c_list = newC
- m_list = newN
- m = int(c_list[0]**(Integer(1)/Integer(e)))
- print(m.to_bytes((m.bit_length()+7)//8,'big'))
- print("Time run:",time.time()-start)
- # ISITDTU{DATSAD_1s_Hastad_h4v3_yOu_3vEr_n0t1ced_dat?_BTW_you_should_start_this_challenge_ASAP_otherwise_it_is_too_late!!!!!}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement