import os from flag import flag from Crypto.Util.number import * from Crypto.Cipher import AES m = 88007513702424243702066490849596817304827839547007641526433597788800212065249 key = os.urandom(24) key = bytes_to_long(key) n=m % key flag += (16 - len(flag) % 16) * b'\x00' iv = os.urandom(16) aes = AES.new(key,AES.MODE_CBC,iv) enc_flag = aes.encrypt(flag)
from Crypto.Util.number import * from Crypto.Cipher import AES
m = 88007513702424243702066490849596817304827839547007641526433597788800212065249 n = 103560843006078708944833658339172896192389513625588 c = b'\xfc\x87\xcb\x8e\x9d\x1a\x17\x86\xd9~\x16)\xbfU\x98D\xfe\x8f\xde\x9c\xb0\xd1\x9e\xe7\xa7\xefiY\x95C\x14\x13C@j1\x9d\x08\xd9\xe7W>F2\x96cm\xeb' iv = b'UN\x1d\xe2r<\x1db\x00\xdb\x9a\x84\x1e\x82\xf0\x86'
temp = m - n
for i in divisors(temp): if184 <= int(i).bit_length() <= 192and temp % i == 0: key = long_to_bytes(int(i)) aes = AES.new(key,AES.MODE_CBC,iv) flag = aes.decrypt(c) ifb"flag"in flag: print(flag) # flag{cf735a4d-f9d9-5110-8a73-5017fc39b1b0}
from flag import flag import random from Crypto.Util.number import *
defgenprime(): o = getPrime(300) whileTrue: r = random.randint(2**211,2**212) if isPrime(o*r+1): return o,o*r+1 o1,p = genprime() o2,q = genprime() n=p*q g = random.randint(2,n) order = o1*o2
a = pow(g, (p-1)*(q-1)//order, n) assertpow(a,order,n)==1
m = bytes_to_long(flag) e = 65537 c = pow(m,e,n) print(f'n={n}') print(f'c={c}') print(f'a={a}') print(f'o={order}') n=44435425447782114838897637647733409614831121089064725526413247701631122523646623518523253532066782191116739274354991533158902831935676078270115998050827358178237970133151467497051097694866238654012042884894924846645692294679774577780414805605811029994570132760841672754334836945991390844881416693502552870759 c=41355409695119524180275572228024314281790321005050664347253778436753663918879919757571129194249071204946415158483084730406579433518426895158142068246063333111438863836668823874266012696265984976829088976346775293102571794377818611709336242495598331872036489022428750111592728015245733975923531682859930386731 a=39844923600973712577104437232871220768052114284995840460375902596405104689968610170336151307934820030811039502338683925817667771016288030594299464019664781911131177394369348831163266849069740191783143327911986419528382896919157135487360024877230254274474109707112110411601273850406237677432935818199348150470 o=1745108106200960949680880500144134006212310627077303652648249235148621661187609612344828833696608872318217367008018829485062303972702933973340909520462917612611270028511222134076453
非预期
由题意知: $$ p = o_1r_1 + 1 \quad q = o_2r_2 + 1 $$
$$ \therefore n = o_1r_1o_2r_2 + o_1r_1+o_2r_2 + 1 $$