🦁

[crypto 249pts] Pipe Rhyme - DarkCTF

2020/10/04に公開約1,000字

challenge

So special

$ cat pipeRhymeChall\(2\).txt 
Chall:- Pipe Rhyme

Chall Desc:- Wow you are so special.

N=0x3b7c97ceb5f01f8d2095578d561cad0f22bf0e9c94eb35a9c41028247a201a6db95f
e=0x10001
ct=0x1B5358AD42B79E0471A9A8C84F5F8B947BA9CB996FA37B044F81E400F883A309B886

megaから落としてくるけど、なんで(2)ついてるの?

solution

Nが270bitしかない。脳死factordbする。
わいわい

>>> N=0x3b7c97ceb5f01f8d2095578d561cad0f22bf0e9c94eb35a9c41028247a201a6db95f
>>> N.bit_length()
270
>>> N
1763350599372172240188600248087473321738860115540927328389207609428163138985769311
>>> p = 31415926535897932384626433832795028841
>>> q = 56129192858827520816193436882886842322337671
>>> p*q == N
True
>>> from Crypto.Util.number import inverse, long_to_bytes
>>> e = 0x10001
>>> d = inverse(e, N - p - q + 1)
>>> ct=0x1B5358AD42B79E0471A9A8C84F5F8B947BA9CB996FA37B044F81E400F883A309B886
>>> long_to_bytes(pow(ct, d, N))
b'darkCTF{4v0iD_us1ngg_p1_pr1mes}'

Zennで書いてみる巻

Discussion

ログインするとコメントできます