以下の処理をするソースコードと、その出力が与えられた。
FLAGを bytes_to_long 関数に渡し、その返り値を m とする。p, q を生成し、Nをpとqの積とする。e = 0x10001 を用意する。pのq乗をNで割った余りを求め、rとする。mのe乗をNで割った余りを求め、cとする。N, r, cを出力する。
とりあえずNをrで割ってみると割り切れたので、これを用いてcに対しRSA暗号の復号を行った。
その結果に
A source code and its output were given. What the code does was:
bytes_to_long function with FLAG as the argument, and store the return value to m.p, q, and store product of p and q to N.e = 0x10001.p to the q-th power modulo N to r.m to the e-th power modulo N to c.N, r, c.
I tried dividing N by r, and found that N is a multiple of r.
Then, I performed RSA decryption of c using the values.
I obtained the flag by applying "To Base" and "From hex" on