0
0

RSA

Posted at

[picoCTF][Cryptography][miniRSA]

Writeup

  • eが小さいと、Low Public Exponent Attackが使えるらしい。
    ということで、3乗根を求める。
dec.py
from Crypto.Util.number import *

c = 2205316413931134031074603746928247799030155221252519872650073010782049179856976080512716237308882294226369300412719995904064931819531456392957957122459640736424089744772221933500860936331459280832211445548332429338572369823704784625368933

def cube_root(c):
    start = 0
    end = c
    while start <= end:
        mid = (start + end) // 2
        if mid * mid * mid == c:
            return mid
        elif mid * mid * mid < c:
            start = mid + 1
        else:
            end = mid - 1

    return -1  # 3乗根が整数でない場合

print(long_to_bytes(cube_root(c)).decode())

screenshot 5.png

  • 参考サイトに値を入力するだけでも行けた。
  • Nは何だったんだろう。
    以上です。

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0