Bootstrap

ctf.show----easyrsa8和funnyrsa1

easyrsa8

 用wireshark打开public.key文件

 用在线网址进行公钥解析

 质因数分解

1)在线网址分解,(很方便,但是有很大的数字时,不能分解)

 2)脚本

def isqrt(n):
  x = n
  y = (x + n // x) // 2
  while y < x:
    x = y
    y = (x + n // x) // 2
  return x

def fermat(n):
    a = isqrt(n)
    b2 = a*a - n
    b = isqrt(n) 
    count = 0
    while b*b != b2:

        a = a + 1
        b2 = a*a - n
        b = isqrt(b2)
        count += 1
    p=a+b
    q=a-b
    assert n == p * q
    print('p=',p)
    print('q=',q)
    return p, q

n=10306247299477991196335954707897189353577589618180446614762218980226685668311143526740800444344046158260556585833057716406703213966249956775927205061731821632025483608182881492214855240841820024816859031176291364212054293818204399157346955465232586109199762630150640804366966946066155685218609638749171632685073
fermat(n)

 最后,用脚本解出flag


                
      
;