from sage.allimport * from Crypto.Util.number import bytes_to_long,long_to_bytes withopen('lN.bin','rb') as f: file = f.read()
lN = [] for i inrange(0,len(file),64): lN.append(bytes_to_long(file[i:i+64]))
N = [] for n in lN: a = n // 2**104 if a notin N: N.append(a) LEN = len(N) B = LEN print(LEN) M = [[0for _ inrange(B)] for _ inrange(B)] for i inrange(500): M[0][0] = 2 ** i for j inrange(1,B): M[0][j] = N[j] M[j][j] = -N[0] RES = Matrix(M).LLL()[0] if RES[0] % 2 ** i == 0: q = abs(RES[0] // 2 ** i) if q != 0 : R = N[0] % q m = ((N[0] - R) // q) % 2 ** 128 print(long_to_bytes(m))