2022浙江省大学生网络与信息安全初赛-Crypto复现
2022浙江省大学生网络与信息安全初赛-Crypto复现
crypto1
task.py
from random import getrandbits
FLAG = b'DASCTF{xxxxxxxxxx}'
print(len(FLAG))
class lfsr():
def __init__(self, seed, mask, length):
self.length_mask = 2 ** length - 1
self.mask = mask & self.length_mask
self.state = seed & self.length_mask
print(self.state, self.mask)
def next(self):
next_state = (self.state << 1) & self.length_mask
i = self.state & self.mask & self.length_mask
output = 0
while i != 0:
output ^= (i & 1)
i = i >> 1
next_state ^= output
self.state = next_state
return output
def getrandbit(self, nbit):
output = 0
for _ in range(nbit):
output = (output << 1) ^ self.next()
return output
seed = getrandbits(32)
mask = getrandbits(32)
box = lfsr(seed, mask, 32)
s = []
for i in FLAG:
s.append(box.getrandbit(8) ^ i)
print(s,len(s))
# [189, 81, 22, 153, 205, 197, 241, 3, 18, 128, 36, 253, 5, 200, 170, 131, 25, 71, 9, 196, 164, 161, 9, 0, 7, 123, 149, 121, 32, 122, 149, 131, 170, 252, 189, 68, 162, 164, 153, 67]
一道比较常规的LFSR密码,只是不知道mask,当然使用B-M算法加上爆破8位就可以轻松求出mask,再根据LFSR密码的特点求出flag。
我的解答
from Crypto.Util.number import *
class lfsr():
def __init__(self, seed, mask, length):
length=32
self.length_mask = 2 ** length - 1
self.mask = mask & self.length_mask
self.state = seed & self.length_mask
def next(self):
next_state = (self.state << 1) & self.length_mask
i = self.state & self.mask & self.length_mask
output = 0
while i != 0:
output ^= (i & 1)
i = i >> 1
next_state ^= output
self.state = next_state
return output
def getrandbit(self, nbit):
output = 0
for _ in range(nbit):
output = (output << 1) ^ self.next()
return output
# part1 求mask
flag=b'DASCTF{}'
s=[189, 81, 22, 153, 205, 197, 241, 3, 18, 128, 36, 253, 5, 200, 170, 131, 25, 71, 9, 196, 164, 161, 9, 0, 7, 123, 149, 121, 32, 122, 149, 131, 170, 252, 189, 68, 162, 164, 153, 67]
out=''
for i in range(7):
b=bin(flag[i]^s[i])[2:].zfill(8)
out+=b
mask_list=[]
for last in range(256):
try:
s='11111001000100000100010111011010100110011000001110001010'
lastb=bin(last)[2:].zfill(8)
s=s+lastb
M=Matrix(GF(2),32,32)
for i in range(32):
ss=s[i:i+32]
sss=list(map(int,list(ss)))
M[i]=vector(sss)
v=vector(list(map(int,list(s[-32:]))))
mask=M.solve_left(v)
st=''
for i in mask:
st+=str(i)
mask_list.append(int(st,2))
except:pass
print(mask_list)
# mask_list=[1458139876, 2252427521, 3807441478, 216380085, 3696070992, 1750340082, 331023166, 2812445596, 4256056269, 1236779887, 755392552, 776768088, 2232138609, 3149322343, 2766694892, 2589264634, 3741809440, 1950370313, 3787069494, 1797192578, 3227110059, 1436784788, 3735162392, 3760155918, 1790676666, 2773294292, 803864416, 222349197, 2279875641, 1209185879, 3266729443, 3814033278, 817319659, 1777427658, 4282506373, 2785539748, 748885264, 303986182, 2562364850, 2226048585, 3723027560, 1464600540, 3254566803, 3771586450, 2602747230, 3711590132, 2798996536, 3284245063, 3090057355, 4264956705, 2245591533, 1470020928, 792413692, 2257841053, 1423202096, 3230363703, 315411610, 1763958358, 3817291234, 204933161, 2556964654, 2778703432, 834699599, 3731928196, 2755318640, 1966572973, 1753656174, 325695906, 3261394815, 3755327932, 2222748885, 1220545739, 782119108, 3793897690, 1433477640, 3133216707, 227704081, 1446758520, 3781730986, 768924340, 4242115689, 1808548126, 3701418956, 270750674, 2268503717, 2809149696, 2599349544, 3269396653, 210563067, 1805982800, 2784426758, 2237851199, 318825708, 3713205178, 739832514, 3796571540, 3128619025, 273288860, 4270716147, 3247825629, 3726240202, 3775004644, 1216080665, 2797343094, 2577663832, 1760556576, 1475862542, 2250771535, 300907428, 3279584661, 2227671815, 2803459150, 3768879836, 787967370, 4234308539, 1766490904, 3753680114, 2550231648, 220830403, 1778411880, 3707139714, 2274195831, 830170781, 2605422608, 2756939326, 3096801113, 312840660, 1427668806, 3824050348, 1239326241, 3765841984, 2610504332, 1792201716, 3812416048, 309799752, 1451241386, 2815155922, 774231830, 3748537966, 3118637309, 1219056005, 3242678337, 806136121, 2242927779, 1962651099, 4246053919, 207508839, 332553840, 3801722632, 4294589271, 2587645876, 2271200235, 1803003596, 1462065810, 2792270826, 3282618121, 3737867094, 3138207669, 796959278, 3716266278, 2215979419, 751454302, 2770616730, 234561631, 1416605922, 278443008, 3236048249, 3788719480, 1748847804, 1225532605, 2574695876]
# part2
mask_l=[1458139876, 2252427521, 3807441478, 216380085, 3696070992, 1750340082, 331023166, 2812445596, 4256056269, 1236779887, 755392552, 776768088, 2232138609, 3149322343, 2766694892, 2589264634, 3741809440, 1950370313, 3787069494, 1797192578, 3227110059, 1436784788, 3735162392, 3760155918, 1790676666, 2773294292, 803864416, 222349197, 2279875641, 1209185879, 3266729443, 3814033278, 817319659, 1777427658, 4282506373, 2785539748, 748885264, 303986182, 2562364850, 2226048585, 3723027560, 1464600540, 3254566803, 3771586450, 2602747230, 3711590132, 2798996536, 3284245063, 3090057355, 4264956705, 2245591533, 1470020928, 792413692, 2257841053, 1423202096, 3230363703, 315411610, 1763958358, 3817291234, 204933161, 2556964654, 2778703432, 834699599, 3731928196, 2755318640, 1966572973, 1753656174, 325695906, 3261394815, 3755327932, 2222748885, 1220545739, 782119108, 3793897690, 1433477640, 3133216707, 227704081, 1446758520, 3781730986, 768924340, 4242115689, 1808548126, 3701418956, 270750674, 2268503717, 2809149696, 2599349544, 3269396653, 210563067, 1805982800, 2784426758, 2237851199, 318825708, 3713205178, 739832514, 3796571540, 3128619025, 273288860, 4270716147, 3247825629, 3726240202, 3775004644, 1216080665, 2797343094, 2577663832, 1760556576, 1475862542, 2250771535, 300907428, 3279584661, 2227671815, 2803459150, 3768879836, 787967370, 4234308539, 1766490904, 3753680114, 2550231648, 220830403, 1778411880, 3707139714, 2274195831, 830170781, 2605422608, 2756939326, 3096801113, 312840660, 1427668806, 3824050348, 1239326241, 3765841984, 2610504332, 1792201716, 3812416048, 309799752, 1451241386, 2815155922, 774231830, 3748537966, 3118637309, 1219056005, 3242678337, 806136121, 2242927779, 1962651099, 4246053919, 207508839, 332553840, 3801722632, 4294589271, 2587645876, 2271200235, 1803003596, 1462065810, 2792270826, 3282618121, 3737867094, 3138207669, 796959278, 3716266278, 2215979419, 751454302, 2770616730, 234561631, 1416605922, 278443008, 3236048249, 3788719480, 1748847804, 1225532605, 2574695876]
for mask in mask_l:
seed=int(out[:32],2)
box = lfsr(seed, mask, 32)
flag=b'DASC'
for i in range(4,len(s)):
flag+=long_to_bytes(s[i]^box.getrandbit(8))
if flag.endswith(b'}'):
print(flag)
crypto2
task.py
from Crypto.Util.number import *
import random
FLAG = b'xxx'
def leak(dp: int, dq: int):
leak_a = []
leak_b = []
for i in range(max(dp.bit_length(), dq.bit_length())):
r = random.getrandbits(32) % 2
if r == 0:
leak_a.append('1' if dp&(2**i) else '0')
leak_b.append('?')
elif r == 1:
leak_b.append('1' if dq&(2**i) else '0')
leak_a.append('?')
print('dp:', ''.join(leak_a[::-1]))
print('dq:', ''.join(leak_b[::-1]))
p = getPrime(512)
q = getPrime(512)
e = 0x10001
d = inverse(e, (p-1)*(q-1))
dp = d % (p-1)
dq = d % (q-1)
assert 55000 <= (e*dp-1)//(p-1) <= 56000
assert 49000 <= (e*dq-1)//(q-1) <= 50000
leak(dp, dq)
print('N:', p*q)
print('c:', pow(bytes_to_long(FLAG), e, p*q))
'''
dp: ??101101110001101000??????0???????1111?0??10?0??0?00?0??????01??1?00??1?011?11?0?10110????010??00?1?10?000????0??0?01??0???00??01?01?100?00110?0??0111?1???0110??00??????1?10?00?0?1????10110??0??110?0?001?????0110??00?01??11?00????000???0?????1?0???1?1??1?10????000?1??????01?10??1?0?0?11????1?00?001???1??1?????1011?0?1?????????0?1???111?01?010?0???10?00?0???00?1??1???00?10????111?0?1???11?110?0?????00110??000100?1????0???1?111010001?1?1???00?11???0?0?1?011?0??011?0???????1??0011100?1???1?1??1??00???0101???0?
dq: 10??????????????????111011?1101100????0?01??1?01?0??0?000110??10?0??11?0???0??0?0?????1110???11??0?1??0???1101?10?0??10?010??11??0??0???0?????1?00????1?110????01??110101?0??1??1?1?0000?????01?11???1?0???11110????10??1??10??0??1011???000?11000?1?001?0?00?0??0000???0?010011??1??10?1?0?1??1101?1??1???111?00?00011????1?1?000000010?1?000???0??1???1?011??0??1?100??0?00?111??1??0010???1?0?110??1???1?00100?????10??????1?1101?111?0?????????1?1?001??1??110?1?1?1???1?10???0?0111000?10???????0?100?1?10?00??111????010?1
N: 77956713622979317783761595054903981958011751094595501314491177382757729657611095418895882363723936522303701334485645032785352259197556402990449635873300021669658762637882700434079432155768745388920298118803003827231120408576526258417243630568234643852227224535788863216313553066059331134379012412201880568839
c: 6373402478226200743899445696426483055555702880465073264671889716957511631194331218010680752909232089491297245558959594952484242066243487601985639038704149982643910363538066540137001662216910771688217243126636396444036372309819771474215211720377034865803003448233174429246078453845273054750113438198122744673
'''
dp,dq在相同的位置上只知道一位,写一个DFS,然后跑一个钟头就可以出结果了吧…
我的解答
from tqdm import *
from Crypto.Util.number import *
from gmpy2 import *
ldp= '??101101110001101000??????0???????1111?0??10?0??0?00?0??????01??1?00??1?011?11?0?10110????010??00?1?10?000????0??0?01??0???00??01?01?100?00110?0??0111?1???0110??00??????1?10?00?0?1????10110??0??110?0?001?????0110??00?01??11?00????000???0?????1?0???1?1??1?10????000?1??????01?10??1?0?0?11????1?00?001???1??1?????1011?0?1?????????0?1???111?01?010?0???10?00?0???00?1??1???00?10????111?0?1???11?110?0?????00110??000100?1????0???1?111010001?1?1???00?11???0?0?1?011?0??011?0???????1??0011100?1???1?1??1??00???0101???0?'
ldq= '10??????????????????111011?1101100????0?01??1?01?0??0?000110??10?0??11?0???0??0?0?????1110???11??0?1??0???1101?10?0??10?010??11??0??0???0?????1?00????1?110????01??110101?0??1??1?1?0000?????01?11???1?0???11110????10??1??10??0??1011???000?11000?1?001?0?00?0??0000???0?010011??1??10?1?0?1??1101?1??1???111?00?00011????1?1?000000010?1?000???0??1???1?011??0??1?100??0?00?111??1??0010???1?0?110??1???1?00100?????10??????1?1101?111?0?????????1?1?001??1??110?1?1?1???1?10???0?0111000?10???????0?100?1?10?00??111????010?1'
n=77956713622979317783761595054903981958011751094595501314491177382757729657611095418895882363723936522303701334485645032785352259197556402990449635873300021669658762637882700434079432155768745388920298118803003827231120408576526258417243630568234643852227224535788863216313553066059331134379012412201880568839
c=6373402478226200743899445696426483055555702880465073264671889716957511631194331218010680752909232089491297245558959594952484242066243487601985639038704149982643910363538066540137001662216910771688217243126636396444036372309819771474215211720377034865803003448233174429246078453845273054750113438198122744673
e=65537
for k1 in tqdm(range(55295,56001)):
for k2 in range(49000,50001):
dp = [0]
dq = [0]
for i in range(len(ldp)):
tmpdp = []
tmpdq = []
for j in range(len(dp)):
if ldp[-1 - i] == '?':
for pp in range(2):
s = (e * (dp[j] + pp * 2 ** i) + k1 - 1) * (e * (dq[j] + int(ldq[-1 - i]) * 2 ** i) + k2 - 1)
if (k1 * k2 * n) % (2 ** (i + 1)) == s % (2 ** (i + 1)):
tmpdp.append(dp[j] + pp * 2 ** i)
tmpdq.append(dq[j] + int(ldq[-1 - i]) * 2 ** i)
else:
for qq in range(2):
s = (e * (dp[j] + int(ldp[-1 - i]) * 2 ** i) + k1 - 1) * (e * (dq[j] + qq * 2 ** i) + k2 - 1)
if (k1 * k2 * n) % (2 ** (i + 1)) == s % (2 ** (i + 1)):
tmpdp.append(dp[j] + int(ldp[-1 - i]) * 2 ** i)
tmpdq.append(dq[j] + qq * 2 ** i)
dp = tmpdp
dq = tmpdq
if dp:
for kk in range(len(dp)):
p=(e*dp[kk]+k1-1)//k1
if n%p==0:
print('done')
print('p=',p)
q=n//p
phi=(p-1)*(q-1)
d=invert(e,phi)
m=pow(c,d,n)
print(long_to_bytes(m))
crypto3
task.py
from secret import flag
assert flag[:7] == 'DASCTF{'
assert flag[-1] == '}'
key = random_matrix(ZZ, 5, 5)
c = 0
def encrypt(e, n):
global c
assert e > 0x10001
c = power_mod(key, e, n)
return c
def decrypt(d, n):
assert d > 0x10001
if c == 0:
print('encrypt first')
return
m = power_mod(c, d, n)
return
def init():
p = random_prime(2^512)
q = random_prime(2^512)
n = p*q
print("n=",n)
for _ in range(3):
opt = int(input('Plz input:'))
if opt == 1:
e = int(input('Plz input e:'))
print(encrypt(e, n))
elif opt == 2:
d = int(input('Plz input d:'))
print(decrypt(d, n))
elif opt == 3:
ikey = input('Plz input nums:').strip()
ikey = list(map(int, ikey.split(' ')))
assert len(ikey) == 25
ikey = Matrix(ZZ, 5, 5, ikey)
if ikey == key:
print(flag)
init()
一个共模攻击,只是这里的key是一个矩阵,还是换汤不换药。
我的解答
没有了环境就大致写一下吧,应该差不多…
from Crypto.Util.number import *
print(getPrime(20))
print(getPrime(20))
from gmpy2 import *
e1=826807
e2=951649
print(gcdext(e1,e2))
n=18333732050438948866929145722058851515599832278814638228866142488493215607530160521341920009432182233189953094579871676089611074579089540181213795407274722695030338019992429688671738485222000599102356441209929229178469898037506987407112122365135187211275050890924887844748573376316982838226378170425149995663
l1=[[ 3603171778643943992185924426311695418052593856834861763180539304487141433134173817450600777554379452178578096706008821036841113793458820608477253646230330981138640663961672722649825567727634815395649750224675526948568021011251730152216121188197672418859509674287708439891458614974289791000973500182061161709 ,10339193581153168042656824196945445568660183093130004177722671758911228957279264481535738014225677058663876752833190419087588150347268736114533020702992827033024495275498210397575432981448935613710884632618882912239893048709421380919794067821827129492296530907435316828276621328031923534186146463657305097710 ,11312885886083494534982542956798623836976535107407248204446162898868937214263700553969087347383899578179993244078266486239416008018149483921972768596353196581491818030260413634447782133587061244884743315688064102309810411642970822557428360448135452474217806956432742029219311509405301141910330798100189549095 , 1494995362986063585588059345206324048148295049219865128730951314539788637070843170815307187875169268644329133365671735371880335228645131671823490538970006197554010629938868738531950933223039245849007840736441168431793114756795338026356771275036275614865215870431831317272620605531962764275372392326244523793 , 9396631602019449363471862898275050983630437164752238861614269203476215834238623842178223262067752487689195391670708491104883804305696544647924130087587346661252042536932651629646949851480796027943748478849042068007813701559789954048118831056028029143154642762569733171460480775310882935209776707990606421351]
,[17731634259249308946054250564734465085175890285919620385017141951163408051809862585156322637003694025340908478083633761429108863477944979896172368151127910144620674589628431843457778851650004255470436349310191366419747603522560708944103577739044771107944285443981548721662733271898350556474672659050502482779 ,16253486596573412025860127024374612674601965770908320454652652039589419201719486491076052725654868334545567304850206265278024217789530382999743736254817006422481968381813658978688641950772468915195439803542747163582987535992318568384183671765387309502151027156571523009567174751438887703670471499290699790887 ,14624986219375630298906665937855726447445694696904183284366547184892116244605092602512776762211561047131584157137131684716702674927041650929977338434629416401850547627070503860642976532752906322611898663914223579716598401833833476314806967591321388598436129345047776734099005923873178703887671378387000990004 , 1040133422110141082507048833901677250517614543617474996505131870140688567824773267037813774037681808261923340955730935237983606271501232017608353878513782221466517562656898686140346407023126780735753211735894776655106616789087727825848894811320255280038606640473478485188878647402504542334864823382099166692, 17049380790474976282141990401064938964179148838888756358480228831249448133496494180298774258083857032242546205187103993358120319590368387997362651073240474215132724206237384828611871603203001418630582149370969919390767829758412133881069924605699750192597371121790583597482153479323969258740933593332146067976]
,[14930690057086152215277918965963747913210266881595660169338866940897230177390409831967024279332710434909733035456304588118894551467353409219518324124267614266692661598448660885241737138294749506512244739251061339471666435077434336803650100738930842558226518161448719676865718258434767238925879342262922227684 , 9303365827122141074696783914435050243672109741521751121011612823852679763714421367074709712756832852984023468347806617949287394455932056910174913082508439379423153667566906332368053389846945892535765371200877824923514231394044681140080819552449828475557343547304252540088069643813258031265486867254391127499 ,14851726003862291320633033712762761645525365223760473497624239718115047434615861131847503555112437474655336015933852197565203641242135505486793500786737068318383728479149779617157097820896646986966574462312735582757236723335617544140803278178407209967790338822747405967090278074040595150376441106950149126229 , 355119749629018898478700210926898352787078142619448143965846885173000951414674940427041126727193284996216513801669997297551065286562474751935099656630798369143509956816955969221769271402807067040475456364504327389774692779843528918824371929137745692285065140045932654938921176588565396139342152521296301836 ,8556888203145214860655625296787657585902898312955720990626174282826517136440418691843791573577132473146469519452521445120531800537046679377119498974623511530451649343851485040127712926987587970004713669081264162927961667168025098509839377512897497516101661699066505733409444363518808295910879319270763818424]
,[ 6100969780713495849746119589798502494485298033721977610635805443742655938695001366054364496901570244224386805180091185587787636860713613276787892779405058987867709483399036070252371415364706576475197991867294235255966021739136137521001325405933411916668400559009725996782209597969139779933414931423604010266 , 5094770600741302317495657877227919924764906087349426012558910139292743678290808221135342263050027655630023640970237977051965813243917739916540840445460772474879766924262279937752897646841001577156103038216878844374348110043698126608977504503393355723393319746710729308109192623637583811875413124959165298132 , 4627829652447463059162990203457807600819201538911271887267568939555589810860307449117643762069191077200019011618961056401251783669287286278514766959187572697992739847637245035115703102828982407262348634449018726612446519478524475394162284303848698152540695028861311482159271234638046865272728205370707180339, 16482338911335016129959227492217980554265377897306420245829749114239068735071163976060910372693218176891900205611571832579729058498676595715438691351916090720538737077735091482437313243481907436186107634185569792289587251222532623334775731578660258696753777205508610589150561079623992282659207875694942083761 , 8267192460848454904782046942959045269490448898828782589328433878920621198819999293389187093548896153119337479179715836460390974597121125728483154865395480150390045626711784167366411561615285631442901425000175027676888784659256296233741652945771583800965061704643515268105342347442011757773560144674909505059]
,[ 3322272303898250725286522311892920905466356411444060535795014802048974421126449772089303955006288183030573539359700576004633702336047602594146059137676168415211361512227425950711959252877377270435723326876760022288156993159554083117975339473057329006373066655729855608315663205614211210856975162164013065869, 15265616322144191976934493442203825103516815692889498134076270115031154037681344950807264383532514889765834784941010166511432971401034954741637080703052834979958559996135669523589034954987781655660538343423045926918300130205050197686909991318013673588091823232161410848047295203849298063020047385168999828728 ,11734146110665074391213990680002022065814333742356181154563643128993561506529818177504959996099372225389313118473510096959386024088636580010398964051851622204968217110593266953445270855148206436557014637527725439859725875434948168300130778906852879048797011557814008715885651204376496927242445091672731589174 , 3317006482457902521781281152906448851352821009206584566948033464461868897182630183091244275142668245652718837457961443731026102064664534361244605846227746822384449802772403098175138981264235912601407842126461583401268497095023405953679698324112881921875802535262730792260617147488071187743834485251903475485 ,2019524988050215739460418406170325749068848634139872507345984479370603849949425453906432504171197751368165043943857487163224556930005466260272364247821561498674733438455619794987067709191339130158479183471440870260444525226943431595780986005951179933971243063290448436211537666679365599213283125973862250193]]
l2=[[14447852968919057963576996783632458427138730314806048279588248427075540104755679290144166669615461670232559903142173202163685758199711952704792589239059569266868760504674688380048920858224508928070767535916670244734085169457203426449896362825072891962680495926259528668808537000251957280405825735019963056632, 3797444110661704943626668266572690019113856965224771455180796472901001475768870535909843102980669313674665075135069357843681622166496620407268572251956080207780224769617053525787888051019913208262202646828420381543721422905789079727867858421475713736144250577440095226409607296195342933253890885314687056804 , 9920370796005696716422823628009748815415037975086408588065271398566657369698230508321203742155566195990652908710994777516058395718534907658355383313842449328784723752084773305493758424577326043966556630250145147968148573806248157376041824630562034662761416883369845327720107703945910875856482535338830957521 , 7050646979035369732439016958919495705311167930567147732933231356161348171477038697757995850614160329363600427339263099330561108478542935675118650258224222316700908978219562018841301024217160379215744491607399534730348614108698311442517594321845203866491715025546735650098282484147000511774787159751475541861 , 1566552132918140304134785445741768517803668122304892070511594039941738157793754493302638066781678051859214085263782285036042907679632130423961269011861108808401859747198790363785776673937594199265383293124264594342106150158937644836786310969692048564729905883503261872653443265079173811987517938158021695018]
,[17934188480319972478456713601360915846847935787051829086614524481787052498615634712724101235231349805711552602794125382825816575555548614907285149722067009365712912060012848096337620826504837612998944218024403869556085536288288336203766292749223076209323458280251181000138417920303497454521816506176721964469, 15538672383932898928603863692534887003454600744568733898489550014872535584419270604297552246926481104629568950258717325807307588877214679432589073286529699629801000647206805160431542173744871189380143599003474544370153716855389937153142788879064133267205229987869406950499671062412449252910860491669962785306 , 2215998298042614077478618760999494424256410008530239405473270159160222520908831719705245701106104993728834487830851458061231665127726003093970161887523303421901675504030929808828236415954413566490104638953705862825852697401207231221968423597263421435011603163694969150480330337963740777484214423989363395047, 17153547683895794304042309788590222025534179471127977352096800872352323295746645420575350754110029129478734653659867563338884804698062034162426917275952611157782214438322290882248127424716684458636593591753877604698409716388716147703356993581688133018369022104161038185728682491050103021515294184023777272505 , 7549088850823501921184239366028667560014449967352977747778991368541119233379044463256488760306888146246079663922802940278704032275184938384916949686809102181715002034788753644841892031713777538168682367011140425155577842842349726349926231897072547979196877934955882656463950285619627266263707979989090917926]
,[ 43394521131678367922221480792616508819533175938534169345085895434899785585413143967258077381895577040415350486510675823949749872358589363470913118971372031307960104806710182213034904004029128807666371045294635844905138491944761189672001016964895353748625880548003757667349832243062768891398401324128944466 , 7406660292437889155983842172094564155773043262418742331370424052890930960190681880182929142974567123647983113706565762109348137530511531236370735085324929437927781653150174057226652270178777284731929259533018031640679479612613904338373692530001478886846107505078451602108963229561792702621788970099074726778 , 3844682983418621869543905096373148159351721597053783916592425692847452547520961069224190779780651822907506841607639882363922098342550148090384762999832310711993832969536289569375637063265324218727110659643313450309704804410912858911471145229618348923724690987484873656322019766832916239670364320645240000297 , 5709387019173050691877952491196609874081742581901372677566216845478342710996041583284918870829247273960772247455095738682535073712697641397813019964539556701447379235308152349311522422717851485736359714218417321914461785668996364357401088820081661145756043774925652773606381472327404349292921303555523475860, 17799984905823861420108851692631741449558050346193046997183494533628574261980244139197428679767249619400581799122416938394876147349232085612076427719230726594354988083717603958848145356833100661062697823948561029113524920467007555276495927968654822176633118819775440798578241736180736380010082668950016079259]
,[ 7772380688594695723565724375202684468049699009547474228625184119779150243771962922956083199565015252990983647599493062027062267408815381562934608881586760096964770316600866439607977490386392416131807584593556898775802267171032427398606420039758729387147651392315256086967153281389687003248250570453907397155 , 4492190181382790781947915564148672873452273884077430828807521416803464612828627588818364815866565883166770994525722558151001264262751494471032501270792950126468525603707497241259842012656433067057698498801148609269235618092092716763527385535946100862112712417375725674671476844414920215712506505810501403764 , 1075613849030219479347549239823976717528298051834516609612518248901821519665742130552908327911198483142665996622797631334335519024907220192910859077894205126768031680695721384976174704516534246359104507842669880009763214050131153971762307628044850014676542426210881933832891800161028319297193940149808498486 ,16178839176903163710093883334971909997227631528835977117960380650205008029597140827305186682623487612085092301698292130365943231295219306651831818133790654833008268268724381690365510392936434904729371751751070001174973574783003181971445483921303233681200430143664224936202416384474442728921136028077876312183 ,14024684527623785930321799480169118880243300706597241342258073693670814349140383970638416437558190824806353027502714748678272125041578776960505445827087641689958520426896066861082679921133753375497672804795521870642187605510368504024686954388994897969937452981682694429075158727100621941349621691338424187177]
,[ 1353167424914320964126192974502030237821996101855582713582331398986801514815972511284458005570415577505684591773602694228132849084790840357787967390279385682033300709724216584342466786029587055572249142669539725287635882820209270170556680335469359819289056131237999978225987503234905798602530972633558112361 , 4859103382948658804180054941616494046876499528491192674100423995554195598514113653641158754038364774785145954795623590907472261680490658563173671368532619224432112486540706181295958390773919858933928897286758393990132346427867463290519260359856502483386597618753009933938607219584406483384893191917011644492 , 7300983693756570088016291701788471142798086894250725738760972658255387841879563743574613377025933848325559085927201194061666983567285420230684991601612692258810428689007680163990678729328296321807385973085247474983784710599457810305202739440538897741036043918791210037863300467598342182420213813867918422827 ,9435584730142805102896963898605223312284631265400822992944670677365939287389112815588900224938487101318215913644517419512014477593001610852622398727374419542993390190213981452375583117789608655969277462036829920104652895969625599910501796127169529309810825651597969266130091252855112969551601844359804820724 , 2107086135466495155199091901634620727736691681352554960046190240502528503442042048390484947322641899367051462933817679688773194973064334637357995857378957170903552548805604324793017093411182481424963287234729280073878894711790214478426729305327086710394950334413762795166342630569219041650807521670595526760]
]
n=18333732050438948866929145722058851515599832278814638228866142488493215607530160521341920009432182233189953094579871676089611074579089540181213795407274722695030338019992429688671738485222000599102356441209929229178469898037506987407112122365135187211275050890924887844748573376316982838226378170425149995663
c1=Matrix(ZZ,l1)
c1=c1.inverse()
c2=Matrix(ZZ,l2)
out=power_mod(c1,333735,n)*power_mod(c2,289954,n)%n
for i in range(5):
for j in range(5):
if out[i,j]>500:
out[i,j]-=n
print(out)
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
x1ao!
喜欢就支持一下吧