from gmpy2 import * from Crypto.Util.number import * from sympy.external.gmpy import iroot
e = 3 c1 = 50693458449321936643002876350314571645483492898191488807231069919804643711069939947465500707751785291672584591666301916695212050174966310675882616625445835779080300345273253975477238447343967750619181738366040673523401544337748601129397554949157167078117809209674480735419596253142185617437157135028553535512 c2 = 68461554119116371147083386089552453735288867510520424213313079173741578139398748933397803590044864350237794073221482820153815072204593815103202302010872607529891174985131560381897122890186935183835887957097497249844470290572296180422540319205795848739267567991676339111284811461432510119947371569758485318185
n = 90544490827178754252962187794189026539597459100491154117742894089808204642960698141161214308791144141515252335630103490253410291789147112970571180845809176325505586392652118182228127519560532500789505277117619230772726766104579482737300391555520381632519494166348010918044038023332622630156514379058214998761 k = 0 while iroot(c1 + k * n, e)[1] == False: k += 1 m1 = iroot(c1 + k * n, e)[0] while iroot(c2 + k * n, e)[1] == False: k += 1 m2 = iroot(c2 + k * n, e)[0] print(long_to_bytes(m1) + long_to_bytes(m2))
Learning cryptography can help people understand and solve these information security problems, so as to better apply in modern information technology. Cryptography technology can meet the basic needs of information security, including identity, authentication, authorization, confidentiality, integrity and availability of information. The security of the system can be improved by the comprehensive application of symmetric cryptography, unidirectional hash function and asymmetric cryptography.
The Caesar cipher is the earliest substitution cipher, using a single column list. The basic idea is to encrypt and decrypt letters by moving a certain number of numbers. All letters in plaintext are moved backward (or forward) by a fixed number in the alphabet and replaced with ciphertext. oh, What is this.[118,136, 116, 134, 121, 143, 110, 133, 140, 56, 127, 137, 144, 138, 129, 62, 147, 136, 134, 66, 147, 133, 153, 154, 140, 154, 151, 167] I think we found a different Caesar code here.
exp:
1 2 3 4 5 6 7 8 9 10 11 12
s='gxctf' l=[118,136, 116, 134, 121, 143, 110, 133, 140, 56, 127,137, 144, 138, 129, 62, 147, 136, 134, 66, 147, 133, 153,154, 140, 154, 151, 167] # for i in range(len(s)): # diff=ord(s[i])-l[i] # print(diff) diff=-15 flag='' for i inrange(len(l)): flag+=chr(l[i]+diff) diff-=1 print(flag)
import gmpy2 from Crypto.Util.number import long_to_bytes, inverse
c = 44444088579666157621732553943670430273576254061474213939712213538406543268662965919310579281902129974974046495922523312658382899557387672355450391484977282423472695576509879204127236418710160228430907224557292043782574207980810012206965736060860845936702829630053500914689948188515065224954864332115028989648 n = 95383564587813903117264084370022798249408254695230018220531107804252937201014457059104201100944471086733795699882077502065034228927715000188417929139360620710897717662055202785483254232630518067785695466739940287445629280210950586820508333226251375040583347752697965543942500565891055165003961304756911395473 dp = 9124290354916175097961830868157352750253514515485171416231465524792780467304908803146834645823716115169328517501242615875895945850599189429277137939616265 e = 746129341247492452183022302843191577 a = 7
# 使用 gmpy2.gcd 计算 p p = gmpy2.gcd(gmpy2.powmod(a, e * dp, n) - a, n) q = n // p
# 使用 Crypto.Util.number.inverse 计算 d d = inverse(e, (p - 1) * (q - 1))