Skip to content

Instantly share code, notes, and snippets.

Carl Löndahl grocid

Block or report user

Report or block grocid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@grocid
grocid / solve.py
Last active Jun 8, 2019
hsctf - multiplication service
View solve.py
p = 2^448 - 2^224 - 1
F=GF(p)
g=F(2)
# use that k * (0, 2) = (0, 2^k), define this to be h
h=F(260571191137716815341287411517193580203843541276741273922047807416174982227377817356425394246343714490986635819120516038840847423836513L)
G=[]
H=[]
X=[]
c=[]
N=[2, 641, 18287, 196687, 1466449, 2916841, 6700417, 1469495262398780123809, 167773885276849215533569, 596242599987116128415063, 37414057161322375957408148834323969]
View securityfestCTF19 - igiveemhell
import os
from Crypto.Util.strxor import strxor
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
from pwn import *
s = remote("igivethemhell-01.pwn.beer", 31337)
s.readuntil("Welcome! Encrypted flag is ")
data = s.recvline().strip()
data = "0" * (len(data) % 2) + data
View securityfestCTF19 - infantrsa
sage: n
808493201253189889201870335543001135601554189565265515581299663310211777902538379504356224725568544299684762515298676864780234841305269234586977253698801983902702103720999490643296577224887200359679776298145742186594264184012564477263982070542179129719002846743110253588184709450192861516287258530229754571
sage: e1=17612083435039538435027548324833878903098829050163163625471599511764464460956313942508578570555972697061266246
....: 65037550324
sage: e2=85509398135110549659975585192919679892196893419532801558009960966070280825622376115029201294472843693778747885
....: 6194680752
sage: a=621044266147023849688712506961435765257491308385958611483509212618354776698754113885283380553472029250381909907
....: 10140004959309317986819737535171899175916096417020638046402928378953260206034110421868707877131961348498746384384
....: 8774508968091261333459191715433931164437366476062407396306790590847798240200479849
sage: b=9099806794154189928468355733364094056780918756255539504959601116379706724690796267255777920618395
View gist:2a8a54f03358ded08b8c504ca7ad91bd
sage: p = 100000007
sage: R = GF(p)
sage: z = R(10).square_root()
sage: g = 17665922529512695488143524113273224470194093921285273353477875204196603230641896039854934719468650093602325707751568
sage: ((R(3)+z)^g-(R(3)-z)^g)/(2*z)
41322239
INSA{41322239}
View gist:30cc924e465f262263406d731706bdb0
def xor(a,b):
return "".join(chr(ord(x) ^ ord(y)) for x,y in zip(a,b))
enc = "2146e5732091ee13f25966a751b85730938017cd1388cdbf66258299d000afce"
dec = b'\xea%]\xd2m\x89\x14\x8dVr\x01\x9as\xe4\xbd/\x91u\xe1W\x96\xea\x935\x99\xd5\xa8|\xf1\x90\xda'
fb = dec[:16]
lb = dec[16:] + "\x00"
assert(len(fb) == 16)
assert(len(lb) == 16)
desired_command = " & cat flag.txt"
View gist:1bdc70b041df6ab53b5064ce4f3d321e
import copy
import random
def find_coverage(g, G):
cnt = 0
for gg in G:
if g in gg:
cnt += 1
return cnt
View gist:b9a5f91e0a5941be096b62ec7f2fb7b8
n = 26507591511689883990023896389022361811173033984051016489514421457013639621509962613332324662222154683066173937658495362448733162728817642341239457485221865493926211958117034923747221236176204216845182311004742474549095130306550623190917480615151093941494688906907516349433681015204941620716162038586590895058816430264415335805881575305773073358135217732591500750773744464142282514963376379623449776844046465746330691788777566563856886778143019387464133144867446731438967247646981498812182658347753229511846953659235528803754112114516623201792727787856347729085966824435377279429992530935232902223909659507613583396967
e = 65537
c = int(("cat flag").encode("hex"), 16)*2
print(base64.b64encode(hex(c)[2:-1].decode("hex")))
print(base64.b64encode("\x02"))
signed = 1405144233879919740224541274865217007024074695154474010291135904140033006041713585071760409875042722454112515126498012904477744710991992387867451635880411827737100373876103508302207985414525191471376949334723129492244386348288473583592520329255030361459267
View gist:255962ebefc23c40e5f5ded39a3206e1
data = """z:$6$AEqLtEqq$1ojEoCgug5dzqeNfjGNE9p5SZFwIul8uOFp9vMZEz50oiUXOVFW3lw1S0fuvFY5ggi5CfbfoWaMDr2bvtSNRC/:17930:0:99999:7:::
a:$6$9Eg69bYI$q75YWUVWb4MYzkcExXukpt.VJ3fX458iZJm1ygpTLwX.CgroHpmeSG88By.zQmKyOHCvBHoA0Q001aBqbkVpg/:17930:0:99999:7:::
x:$6$5TF0Txe3$APSNzUSjFmMbsmrkCS9qE84qfu4AI2dNEjqm2PRKgSjncBTI4lECXofQ8abdAtYX6tST6FGCgOdvLlDYQTCJx0:17930:0:99999:7:::
q:$6$I3iqZL0m$nxHWvcLz7lg/ZKoKfX9dq5k0uqkOtKgLdyREAQxQkfPkVvbNHPfQaoCFfnXl1BoX1vgOcEDghVPvfRUrs6dGp1:17930:0:99999:7:::
l:$6$n8iJWaW/$M1Od8seiEL6h3L.egHubBYAk.cd8/LUctESIm69/r.gvP0eqabusN5/D1rNu1qDHOkgRpHf8PWGSb8zoxrgrp1:17930:0:99999:7:::
v:$6$GatagTHS$I1UfNfn3NGP5Vre0z7s3DGqFpjN5Pw2XhAHSw6ZSMwaMAsf8IteFedXovNlHLuIXvR9ezeya89XEOq2We7CcW1:17930:0:99999:7:::
e:$6$ZO6YiExi$7DBV0zMIqf8iy.zVTL7gbHetCmJ3LL4ROEYG/UME4Tmym82vZYkFWjiNpCGapvF83QNJKFJOjkhXMgFLfkhza.:17930:0:99999:7:::
f:$6$HXoF2OZ1$onkVfp52IRdd2OipQv3rPPsGr7QradAFTFnmXv5c9xkGy4xcgJFkoaSJzMQCtfWuU2FQ3BN3lyL47SyoIoPmy0:17930:0:99999:7:::
b:$6$I9Uq9PRG$euVEYx5TR2lUFe/k7s0e8us8xgl7j/cbiYRnvba.
View gist:0435ab85eedc9b4721f373cead14b918
a = 38555641240142650191590665
b = 23359130730155144478219192
c = 23880474167586014776570576
d = 42898493346005241877878759
e = 44617407039071303012851645
X = (c-d)^2-(d-e)*(b-c)
Y = (b-c)^2-(c-d)*(a-b)
mod = gcd(X,Y)
@grocid
grocid / nmc.py
Last active Nov 26, 2018
ASIS - NMC
View nmc.py
import gmpy
import gmpy2
from fractions import gcd
def dec(n):
return hex(int(n))[2:].rstrip("L").decode("hex")
a = 6129045310763021790856152782924435339394912490651057968119749104677844846162024187811538414115989381648951838817446260921271338817469089315786401389425432101937455179482722831943870567609546871302790334453123063844667446129248579853099572319467917572203259488663792717230663614348203087634000738716846236453
b = 21004857544287019239408534531449948348159609726790908306974348947117991714054409869257133081929914591459899655908141325761521904936043948049419550774861506510243817009663859463393778639031555475954933858324795455033652926443512596678184253204623932432419421335015720413437778576835470802621470778941669835875
c = 2972136493183965344114007674609993597713072794880759772984437641427657180110495134274004221892375842569585334922918679459749045191061404192934156403495451739226616965840615191049809949608090285920936868955012790946030557079305959536719856549904210788958874172140095396604584707828
You can’t perform that action at this time.