-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathchall.py
More file actions
31 lines (25 loc) · 6.26 KB
/
Copy pathchall.py
File metadata and controls
31 lines (25 loc) · 6.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import numpy as np
import galois
from secret import gen_commuting_matrix
from Crypto.Util.number import *
from Crypto.Random import random
GF = galois.GF(202184226278391025014930169562408816719)
A = GF([(93236461031571994514321944202944533380, 149290374594137348155643110785586052428, 87885425388105434901611821466675655842, 201630265954893846719972849887081515048, 134984605532082862632100466791118910962, 91421716697239424147505169342981562145, 151743870910505873325552694082581341808, 6907765510091994792103355066236141911, 125303005736227590210927538054125303789, 148215471808515136247457645281509263885, 15784102923077969190680991081241028086, 60574709915271430724193539201054834838),
(188884144704430971439852843440499987131, 189718425048086553935817759374181453498, 121512254829912939278832289344246375836, 29464297023667868726172853291143103149, 27154906746169793841228543660391094253, 39718330217137403865588337462536594529, 147045909360653829333226274557704692025, 82519570075848332871010720989990189256, 52848984630090489641619169446161478367, 117653224352408311265769927891568140519, 99347019674573640624462449628525602772, 99781183661107699864222095864944832419),
(129044773839540712807147109700501379250, 188121067524752942188870861847200052615, 126963532796308972841784066811629663109, 26690077858560011094980098350399507736, 129267077306471579463757665909209709900, 202145748486056962015643581866781488122, 131411007899406130859809436127437208515, 185239521020881682187709008100131945906, 175992433382611568284177046749235329017, 116659098144318792705780055747063333812, 159385273705402772807103652404322927335, 59052924544719474225848594673849463164),
(148020142145000490644168335923067693661, 187970637127815587284208562069025955275, 7095878221951601724341714914991013284, 136959414706069746268877867795767823893, 16652911952961573617630795873935833781, 161529407289790291633761758921651989173, 35046708722400477537548873293936733920, 71720871143348871614447120129111266710, 126224396622328541486781051458029521114, 173371859119772457995375367039500939818, 158238915852636214418589620190064605829, 163425403952646495416510518616841870717),
(92378915584785974336332580226182114135, 72244894241550323324781465221299930260, 129157248211350545507515491402007679934, 195366122111164316282846652000874212959, 50677715402867040301468668029522502705, 136399716902620276816822012972329933828, 115610798470757691660512167889747418373, 201207196208634275427991962480655405566, 52907909783701438591731174977162118297, 164140142842686725471785120361456199708, 94856644558550213507356067797472735723, 98291511995910835016433778222238097074),
(15300784725076187182335193785459511724, 35673629127010863924154636169598403849, 187645684746945894127179262368596441640, 51252050450854193853017360879240111471, 103354653246286847936507984609888273835, 81436801251663680608704446998126306103, 101683032699666529464982006028762303762, 84160222237877466431719810725493553158, 93049539729313406605658706464977713701, 3758512837678354726428910706515656867, 1053770752475429783503251701535897092, 178925475191654483508297577521070246844),
(36954857482787776810101248812926409869, 189868686961422275672256540786907078410, 21705362706918686860324704335893803194, 96991308460684727834986161378858405289, 171898975080894213668401316085909906328, 60733344309131526686127652617702022682, 24459001914613186294647900846083008139, 113041846912048843599017145172291582595, 71568907880617549568028724547217625443, 158397528375585039921864150263898806614, 191476466126064750727182402219268620379, 168238393837150666798182001370889910240),
(156356429541482211738802795191704090574, 178177696859967500434136965764725900707, 70582344686935932669754747382005644208, 52139981249083486367631546706591024479, 171623692032835404179044646003378120859, 108577245415251644453523340909422167166, 130138881928614512221782653822504280222, 193147829513335213359038965144206541749, 158642186502628473711686015471477255792, 126815539663798847299990118145102505877, 168832438516338264690876475221676619449, 38916259758385447131896304725252937617),
(125486981022970348321828309304243768935, 136649435084413625334313110695307250023, 144070702051668742794913426997422811496, 109903535203934544454568178625935270941, 64641384572309927882278685885277567838, 59685605734702011985800246559490201388, 55882960922649996007329846563423432564, 177585941236527507168387457221127913621, 82332762183802439902351564622617502231, 169364805725305983167240041828403340670, 28466634069130462477140303132358491087, 188472213890674105275036546170618288572),
(65949659306401270926575206937849098933, 42766382713442552368867500383009364557, 197235603157721431064301955032633112034, 163032838474866637795737536156571463347, 9654284404303465229485505260834480593, 142196672411043706272768904489491629876, 174997656665556860345510090983718914396, 109552307683070149216026560861077444592, 143053107309494140049084817612307285677, 105265405077985742969225115448499278198, 77145155193507525762726986759845378207, 92624212725527351553883074174355529562),
(72525414926951708289322980458934544301, 22113642508583062154572661102851599711, 57174459601044730361054081944246054560, 4119527049851984490564324669388611495, 159636464113910058179161745833525487269, 194995768852602094626543380324176327353, 17054713015472793412242863714162982663, 168774780888378495991681783921738013737, 42911896141145263876423672795403301693, 110309759843339405296969691145109274665, 112593140708720038161288176613449012679, 161576023758793401014888842436109780086),
(70402402191545650743173366189157060872, 152153753543011445257543539608491942592, 82483587008037994668783284523904638974, 2053254854218661236077303904307376412, 57184063768417379387519463398643077134, 175801385590759723368848540553101323959, 124744775698079991729916496416687434658, 19602330330424417634886192905847757326, 17122416538967859088508688835962913721, 115872608189711536456759996411692309602, 104405804817427134888818463239876972365, 143579455144595408589351577811236225269)])
FLAG = b'uoftctf{jus7_4_s1mple_tr4nslation_t0_GF(p^12)}'
bits = bin(bytes_to_long(FLAG))[2:].zfill(8*len(FLAG))
for b in bits:
if b=='0':
print(gen_commuting_matrix(A))
else:
print(np.linalg.matrix_power(A, random.randrange(202184226278391025014930169562408816719**12-1)))