initial commit
This commit is contained in:
15
CTF/CryptoSystem/file.py
Normal file
15
CTF/CryptoSystem/file.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from Crypto.Util.number import *
|
||||
from flag import FLAG
|
||||
|
||||
def primo(n):
|
||||
n += 2 if n & 1 else 1
|
||||
while not isPrime(n):
|
||||
n += 2
|
||||
return n
|
||||
|
||||
p = getPrime(1024)
|
||||
q = primo(p)
|
||||
n = p * q
|
||||
e = 0x10001
|
||||
d = inverse(e, (p-1) * (q-1))
|
||||
c = pow(bytes_to_long(FLAG.encode()), e, n)
|
||||
Reference in New Issue
Block a user