Skip to content

Instantly share code, notes, and snippets.

🍊
Something

Aleksei hellman

🍊
Something
View GitHub Profile
@hellman
hellman / 0writeup.ipynb
Last active Jun 3, 2020
RCTF 2020 - infantECC
View 0writeup.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hellman
hellman / solve.py
Created May 31, 2020
RCTF 2020 - MultipleMultiply
View solve.py
from sage.all import *
import ast, sys, subprocess
import hashlib
from random import shuffle
from time import time
while True:
data = subprocess.check_output("nc 124.156.133.6 22298 </dev/null", shell=True).splitlines()
p = int(data[0])
nums = ast.literal_eval(data[1].decode())
@hellman
hellman / 0_solve.sage
Created May 4, 2020
De1CTF 2020 - NLFSR
View 0_solve.sage
from sage.all import *
ma, mb, mc, md = 0x505a1, 0x40f3f, 0x1f02, 0x31
maxa = maxb = 1 << 19
maxc = (1 << 13)
maxd = (1 << 6)
def hw(a):
res = 0
while a > 0:
@hellman
hellman / 0_writeup.py
Last active Jul 27, 2020
De1CTF 2020 - EasyRSA
View 0_writeup.py
from sage.all import *
cipher = 5089249888618459947548074759524589606478578815336059949176718157024022678024841758856813241335191315643869492784030633661717346809979076682611760035885176766380484743187692409876479000444892361744552075578050587677106211969169204446554196613453202059517114911102484740265052582801216204900709316109336061861758409342194372241877343837978525533125320239702501424169171652846761028157198499078668564324989313965631396082388643288419557330802071756151476264735731881236024649655623821974147680672733406877428067299706347289297950375309050765330625591315867546015398294367460744885903257153104507066970239487158506328863
e1 = 404631632429186691057151456165799596229515836470293346038946882707287286529392081426651522871043897025702106506439028114895075946268749807973667290687512894419814093148244974114798895978828271531030717098678340265519629670461128544775214995653130357468085954191024301467239122993438613247502430868685203292435795248909029555249146770214026315998267501893269257684795200
@hellman
hellman / writeup.ipynb
Created May 3, 2020
De1CTF 2020 - Mini Pure Plus
View writeup.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hellman
hellman / 0_solve.sage
Last active Apr 19, 2020
PlaidCTF 2020 - MPKC (Crypto 350)
View 0_solve.sage
from sage.all import *
import sys
q,n,a,s = (3,59,10,25)
m = n+1-a+s
FF = GF(q)
R = PolynomialRing(FF, ["x{}".format(i) for i in range(n)])
xs = R.gens()
pk, ct = open("output").readlines()
@hellman
hellman / 0_chall.py
Created Feb 14, 2020
Codegate 2020 Quals - Munch (Crypto 750)
View 0_chall.py
#!/usr/bin/env python3
from Crypto.PublicKey import RSA
from Crypto.Util.number import getPrime, bytes_to_long as b2l
from itertools import cycle
from random import randint
class reveal:
def __init__(self, info, bitlen):
self.coeff = cycle(info)
@hellman
hellman / 1_solve.sage
Last active Feb 13, 2020
Codegate 2020 Quals - Polynomials (Crypto 810)
View 1_solve.sage
from os import urandom
from Crypto.Util.number import long_to_bytes as l2b
from Crypto.Util.number import bytes_to_long as b2l
from Crypto.Cipher import AES
from data import *
load("chall.sage")
keys = []
@hellman
hellman / ctfzone2019_ntru_active_attack.py
Last active Dec 1, 2019
CTFZone 2019 Quals - NTRU (Crypto - Hard)
View ctfzone2019_ntru_active_attack.py
#!/usr/bin/python3
"""
The decryption looks like this:
(f * ctpol) % q * inverse(f, mod 3) % 3
Note that;
- (f) is a "small" polynomial (61 values 1 and -1, others are zero).
- (% q) is done to [-63; 64]
If (f*ctpol) does not wrap over q
@hellman
hellman / crazy_repetition_of_code.ipynb
Last active Oct 20, 2019
SECCON 2019 CTF Quals - Crazy Repetition of Codes (crypto)
View crazy_repetition_of_code.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.