본문 바로가기

카테고리 없음

dreamhack 1119

반응형
from M import M
from sage.all import *

result = [46815, 54436, 41979, 52634, 9427, 38200, 30164, 30742, 37278, 27003, 60542, 47536, 61611, 9732, 18365, 23026, 41731, 25299, 3968, 11754, 5594, 13472, 47963, 62980, 14030, 45400, 27929, 22796, 6570, 1164, 9962, 23574, 19373, 17887, 58878, 20221, 52376, 54543, 36488, 25377, 56175, 20339, 35820, 26224, 7980, 43220, 8400, 51986, 54412, 3511, 43757, 22202, 19450, 39390, 19659, 27620, 47137, 36933, 11093, 6044, 4901, 2205, 13024, 12396]

mod = 0x10001
n = 64

Zm  = Zmod(mod)

for idx, ch in zip([0, 1, 2, n - 1], b"DH{}"):
    t = [0 for _ in range(n)]
    t[idx] = 1
    result.append(ch)
    M.append(t)


M = Matrix(Zm, M)
result = vector(Zm, result)

flag = M.solve_right(result)
print("".join([chr(i) for i in flag]))
반응형