Skip to content

Instantly share code, notes, and snippets.

@samueltangz
Created November 17, 2019 17:17
Show Gist options
  • Save samueltangz/ae5c0a8b7046b643da053d0e4a892841 to your computer and use it in GitHub Desktop.
Save samueltangz/ae5c0a8b7046b643da053d0e4a892841 to your computer and use it in GitHub Desktop.
def gcd(a, b):
while b: a, b = b, a % b
return a
a1 = 97
b1 = 60824696933898946564451801612435320499799420685700840763560112095108031899334
a2 = 98
b2 = 55380756008140998400554730883757097743477949263876721308471329268298435052112
a3 = 99
b3 = 74193339277347514708965540905420499429551183132658118576165808841075904065168
a4 = 100
b4 = 58561111232783009414036747355710818120770460355064109937627143063416498149967
a5 = 101
b5 = 13460258069920711984473815214792450314382512265767416652201216675151887474248
a6 = 102
b6 = 99091883842591738013033776750286741737294079977088755302589111335820787946080
g = 0
A = matrix([
[ 1, a1, -b1, -a1*b1 ],
[ 1, a2, -b2, -a2*b2 ],
[ 1, a3, -b3, -a3*b3 ],
[ 1, a4, -b4, -a4*b4 ]
])
g = gcd(g, A.det())
A = matrix([
[ 1, a1, -b1, -a1*b1 ],
[ 1, a2, -b2, -a2*b2 ],
[ 1, a3, -b3, -a3*b3 ],
[ 1, a5, -b5, -a5*b5 ]
])
g = gcd(g, A.det())
A = matrix([
[ 1, a1, -b1, -a1*b1 ],
[ 1, a2, -b2, -a2*b2 ],
[ 1, a3, -b3, -a3*b3 ],
[ 1, a6, -b6, -a6*b6 ]
])
g = gcd(g, A.det())
print g
A = matrix(Zmod(99332995980571808121940164713168924855142553087587629436579520340836086066719), [
[ 1, a1, -b1, -a1*b1 ],
[ 1, a2, -b2, -a2*b2 ],
[ 1, a3, -b3, -a3*b3 ],
[ 1, a4, -b4, -a4*b4 ]
])
print A.rref()
'''
[ 1 0 0 21469105448478083850592085151636124422130302964504424478512536571561804564879]
[ 0 1 0 55230521701413712771330947170808911737227281006933804490238710618890151383642]
[ 0 0 1 42664941100970507197569124526178202938431203200943609572425503404060840378094]
[ 0 0 0 0]
'''
enc_flag = 59144381009618733582905324230862702209434929884783490385305907409783447109557
a = 21469105448478083850592085151636124422130302964504424478512536571561804564879
b = 55230521701413712771330947170808911737227281006933804490238710618890151383642
c = 42664941100970507197569124526178202938431203200943609572425503404060840378094
d = -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment