题目
This commit is contained in:
18
crypto/easy_rsa/easy_rsa.py
Normal file
18
crypto/easy_rsa/easy_rsa.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from Crypto.Util.number import *
|
||||
import os
|
||||
|
||||
flag = os.getenv("FLAG")
|
||||
flag = b"flag{wow}"
|
||||
flag = str2long(flag)
|
||||
p = getPrime(64)
|
||||
q = getPrime(64)
|
||||
n = p * q
|
||||
e = 65537
|
||||
print(n)
|
||||
phi = (p - 1) * (q - 1)
|
||||
d = inverse(e, phi)
|
||||
cipher = pow(flag, e, n)
|
||||
print(cipher)
|
||||
flag = pow(cipher, d, n)
|
||||
flag = long_to_bytes(flag)
|
||||
print(flag)
|
Reference in New Issue
Block a user