Skip to content

Instantly share code, notes, and snippets.

import binascii
import random
from Crypto.Util.number import isPrime
flag = open("flag.txt", "rb").read().strip()
m = int(binascii.hexlify(flag), 16)
def genPrimes(size):
base = random.getrandbits(size // 2) << size // 2
base = base | (1 << 1023) | (1 << 1022) | 1
from gmpy2 import *
from Crypto.Util.number import *
def fermatfactor(n):
a = isqrt(n) + 1
b = a * a-n
while not is_square(b):
a = a + 1
b = a * a -n
b = isqrt(b)
return (a + b, a -b)
c = 3708354049649318175189820619077599798890688075815858391284996256924308912935262733471980964003143534200740113874286537588889431819703343015872364443921848
e = 16
p = 75000325607193724293694446403116223058337764961074929316352803137087536131383
q = 69376057129404174647351914434400429820318738947745593069596264646867332546443
import os
import socketserver
import string
import threading
from time import *
import random
import time
import binascii
from Crypto.Cipher import AES
from pwn import *
ct=[]
def byte_xor( ba1, ba2):
return bytes([_a ^ _b for _a, _b in zip(ba1, ba2)])
for i in range(10):
p=connect('161.97.176.150' ,'3167')
rev=p.recvline().decode()[:-1]
rev=bytes.fromhex(rev)
if rev not in ct:
ct.append(rev)
import os
import socketserver
import string
import threading
from time import *
import time
import binascii
import random
flag = open("flag.txt", "rb").read().strip()
from pwn import *
from Crypto.Util.number import *
def next_state(arr):
n=pow(2, 607) -1
m = (arr[2]-arr[1])* inverse(arr[1]-arr[0],n) % n
c = arr[1]-m*arr[0] % n
print(f"n: {n}")
print(f"m: {m}")
print(f"c: {c}")
return (arr[-1]*m+c)%n
from Crypto.Util.number import *
import itertools
from gmpy2 import *
c=3708354049649318175189820619077599798890688075815858391284996256924308912935262733471980964003143534200740113874286537588889431819703343015872364443921848
e=16
p=75000325607193724293694446403116223058337764961074929316352803137087536131383
q=69376057129404174647351914434400429820318738947745593069596264646867332546443
def square_root(c):
from string import ascii_lowercase,ascii_uppercase
flag_enc="cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_MAZyqFQj}"
flag=''
for i in flag_enc:
if i in ascii_lowercase:
flag+=ascii_lowercase[(ascii_lowercase.index(i)+13)%len(ascii_lowercase)]
elif i in ascii_uppercase:
flag+=ascii_uppercase[(ascii_uppercase.index(i)+13)%len(ascii_uppercase)]
else:
flag+=i
Decrypt my super sick RSA:
c: 62324783949134119159408816513334912534343517300880137691662780895409992760262021
n: 1280678415822214057864524798453297819181910621573945477544758171055968245116423923
e: 65537