Skip to content

Instantly share code, notes, and snippets.

View hellman's full-sized avatar
🍊

Aleksei Udovenko hellman

🍊
View GitHub Profile
@maple3142
maple3142 / example.sage
Last active April 19, 2024 16:43
LLL/CVP utilities
from lll_cvp import *
from functools import partial
def example1():
# copied from https://github.com/rkm0959/Inequality_Solving_with_CVP/blob/main/Example%20Challenge%204%20-%20HITCON%20CTF%202019%20Quals%20-%20not%20so%20hard%20RSA/solve_challenge_4.sage
## Example 4 : HITCON CTF 2019 Quals not so hard RSA
## d is 465 bits
@maple3142
maple3142 / flatter.sage
Last active September 10, 2023 13:18
trying https://github.com/keeganryan/flatter for faster lattice reduction than LLL
from subprocess import check_output, DEVNULL, CalledProcessError
import itertools
import IPython
import time
def to_fplll_format(M):
m, n = M.dimensions()
ret = ""
s = "["
@sasdf
sasdf / solve.cpp
Last active November 29, 2021 06:18
DragonCTF 2021 CRC Recursive Challenge
// g++ -O3 solve.cpp -fopenmp && ./a.out
//
// Credits:
// Algorithm: @utaha1228
// Optimization: @sasdf
#include "table.h" // Generated by python3 solve.py
#include <omp.h>
#include <cstdint>
#include <cstdio>
@33eyes
33eyes / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active April 19, 2024 12:41
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally
  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  
  1. Create a .gitattributes file inside the directory with the notebooks

  2. Add the following to that file:

*.ipynb filter=strip-notebook-output  
@msjyryxdzzj
msjyryxdzzj / sol.sage
Last active January 14, 2024 15:33
RWCTF 3rd - Crypto - Old Curse solve script
from Crypto.Util.number import *
PR.<qr>=PolynomialRing(ZZ)
def calc_params(e,N):
delta = 0.1
gama = 0.05
beta = log(e,N).n()
alpha = 0.25
return alpha,beta,delta,gama
@rekkusu
rekkusu / sharsable.sage
Last active October 19, 2020 06:51
SECCON 2020 Online CTF sharsable author writeup
# Overview
# This challenge is based on May's version of Wiener's Attack
# (https://www.math.uni-frankfurt.de/~dmst/teaching/WS2015/Vorlesung/Alex.May.pdf)
# But the attack can't be apply to the challenge because it has 2 exponents,
# so you have to extend the method of May.
# After LLL, choose 2 shortest vectors and reconstruct polynomial.
# then pick coefficients and decrypt ciphertext
import json
from binascii import unhexlify
@gaulinmp
gaulinmp / nopromotedtweets.js
Created October 6, 2020 17:26
Tampermonkey script to remove promoted tweets
// ==UserScript==
// @name Twitter Promoted
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Get rid of stupid promoted tweets
// @author Mac Gaulin
// @match http*://twitter.com/*
// @grant none
// ==/UserScript==
@birdg0
birdg0 / solve.c
Last active September 27, 2020 09:25
Official solution for "Shoplifters" of 0CTF/TCTF 2020 Finals
/*
gcc -m64 -nostdlib -Os -mrtm -fno-toplevel-reorder -static -Wno-multichar solve.c -o solve.elf
objcopy -Obinary -j .text solve.elf solve.bin
Reference https://github.com/Alberts-Coffee-Hours/Mastik/blob/master/src/l1.c,
https://github.com/vusec/ridl/blob/master/exploits/shadow/leak.c
and https://github.com/oranav/ctf-writeups/blob/master/gctf19/RIDL/solve.c
*/
#include <stdio.h>
#include <stdlib.h>
@ruan777
ruan777 / MultipleMultiply.ipynb
Created June 2, 2020 06:50
RCTF2020 Crypto solution
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hellman
hellman / ctfzone2019_ntru_active_attack.py
Last active December 1, 2019 21:26
CTFZone 2019 Quals - NTRU (Crypto - Hard)
#!/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