suspicious_prime

Securinets Quals 2022 | Escrime

#Securinets_Quals_2022 from Crypto.Util.number import getStrongPrime, getPrime, isPrime, bytes_to_long FLAG = b"Securinets{REDACTED}" def genPrime(prime): while True: a = getPrime(256) p = 2*prime*a + 1 if isPrime(p): break while True: b =…

Ricerca CTF 2023 | Rotating Letters

#ricerca_ctf_2023 #RSA #Suspicious_Prime #素因数分解 https://furutsuki.hatenablog.com/entry/2023/04/23/143704#Rotated-Secret-Analysis

Pwn2Win 2020 | Omni Crypto

#RSA #quadratic_residue (mon でのquadratic residue) #univariate_coppersmith_method #Suspicious_Prime https://furutsuki.hatenablog.com/entry/2020/06/01/023111#crypto-Omni-Crypto LSB と MSBがあわせて1024bitくらいわかるので解ける

IJCTF | klepto

#!/usr/bin/env python3 from random import getrandbits, randrange def generate(): IV = 532645365660741748592492683919913241393173602551561153678419663766604876396695082772115623037919135095305534947595527762871071624714167681814698732667699…

CONFidence CTF 2019 Teaser|Really Suspicious Acronym

#CONFidenceCTF2019Teaser #RSA https://ctftime.org/task/7836 You can't break my public key if you don't know it, amirite? The flag format is: p4{letters_digits_and_special_characters}. def bytes_to_long(data): return int(data.encode("hex"),…

Circle City Con CTF 2021 | No Stone Left Unturned

#circle_city_con_2021 from gmpy2 import next_prime, is_prime import random, os, sys if __name__ == "__main__": random.seed(os.urandom(32)) p = next_prime(random.randrange((1<<1024), (1<<1024) + (1<<600))) pp = (p * 7) // 11 q = next_prime(…

ASIS CTF Finals 2022 | bedouin

#ASIS_CTF_Finals_2022 #!/usr/bin/env python3 from Crypto.Util.number import * from secret import nbit, l, flag def genbed(nbit, l): while True: zo = bin(getPrime(nbit))[2:] OZ = zo * l + '1' if isPrime(int(OZ)): return int(OZ) p, q = [genb…

Fword CTF 2020 | Mini Cooper

#!/usr/bin/python from Crypto.Util.number import * from random import * from gmpy2 import * from fractions import * from binascii import hexlify from secret import flag #Setting up params a = randrange(2**10,2**11) b = randrange(2**12,2**1…

zer0pts CTF 2022 | Anti Fermat

#zer0ptsCTF2022 from Crypto.Util.number import isPrime, getStrongPrime from secret import flag def next_prime(n): n += 1 while not isPrime(n): n += 1 return n # Anti-Fermat Key Generation p = getStrongPrime(1024) q = next_prime(p ^ ((1<<10…

Midnightsun CTF 2021 Quals | ocat_024

#midnightsunctf2021quals u = getrandbits(512) p = next_prime(1337 * u + getrandbits(300)) q = next_prime(2021 * u + getrandbits(300)) n = p * q sage: n 376347864369130929314918003073529176189619811132906053032580291332225522349124770927556…

HITCON CTF 2022 | superprime

#HITCON_CTF_2022 from Crypto.Util.number import getPrime, isPrime, bytes_to_long def getSuperPrime(nbits): while True: p = getPrime(nbits) pp = bytes_to_long(str(p).encode()) if isPrime(pp): return p, pp p1, q1 = getSuperPrime(512) p2, q2 …

Fword CTF 2020 | Schuuuuush

from Crypto.Util.number import getPrime, bytes_to_long from gmpy2 import gcd from sympy import nextprime from secret import flag,BITS def func(x, bits): return x**12 + (x & (2 ** (bits/2) - 1)) def PrimeGen(bits): pr = getPrime(bits) p = n…