From c08b46c9de7d95a6d9fca268cf6402281e93cc7a Mon Sep 17 00:00:00 2001 From: sangge <2251250136@qq.com> Date: Wed, 1 Nov 2023 15:26:25 +0800 Subject: [PATCH] fix: add flag --- crypto/easy_rsa/cipher.txt | 3 +++ crypto/easy_rsa/easy_rsa.py | 16 +++++++++------- crypto/easy_rsa/flag.py | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 crypto/easy_rsa/cipher.txt create mode 100644 crypto/easy_rsa/flag.py diff --git a/crypto/easy_rsa/cipher.txt b/crypto/easy_rsa/cipher.txt new file mode 100644 index 0000000..6cd1661 --- /dev/null +++ b/crypto/easy_rsa/cipher.txt @@ -0,0 +1,3 @@ +n = 412185872968401257793868364974500949106246851673 +e = 65537 +cipher = 238402953668524899208063558207075404357269541120 diff --git a/crypto/easy_rsa/easy_rsa.py b/crypto/easy_rsa/easy_rsa.py index d99de8f..ca74125 100644 --- a/crypto/easy_rsa/easy_rsa.py +++ b/crypto/easy_rsa/easy_rsa.py @@ -1,11 +1,9 @@ from Crypto.Util.number import * -import os +from flag import flag -flag = os.getenv("FLAG") -flag = b"flag{wow}" -flag = str2long(flag) -p = getPrime(64) -q = getPrime(64) +flag = bytes_to_long(flag) +p = getPrime(80) +q = getPrime(80) n = p * q e = 65537 print(n) @@ -15,4 +13,8 @@ cipher = pow(flag, e, n) print(cipher) flag = pow(cipher, d, n) flag = long_to_bytes(flag) -print(flag) \ No newline at end of file +print(flag) +with open("cipher.txt", "w") as f: + f.write(f"n = {n}\n") + f.write(f"e = {e}\n") + f.write(f"cipher = {cipher}\n") \ No newline at end of file diff --git a/crypto/easy_rsa/flag.py b/crypto/easy_rsa/flag.py new file mode 100644 index 0000000..9927816 --- /dev/null +++ b/crypto/easy_rsa/flag.py @@ -0,0 +1 @@ +flag = b"0xFA{F4ct0r_Pr1me}" \ No newline at end of file