Skip to content

Instantly share code, notes, and snippets.

View elliptic-shiho's full-sized avatar

Shiho Midorikawa elliptic-shiho

View GitHub Profile
@niklasb
niklasb / gracias.py
Last active July 15, 2019 02:32
Crypto solutions ASIS CTF finals
from sage.all import continued_fraction, Integer, inverse_mod
pubkey = (1696852658826990842058316561963467335977986730245296081842693913454799128341723605666024757923000936875008280288574503060506225324560725525210728761064310034604441130912702077320696660565727540525259413564999213382434231194132697630244074950529107794905761549606578049632101483460345878198682237227139704889943489709170676301481918176902970896183163611197618458670928730764124354693594769219086662173889094843054787693685403229558143793832013288487194871165461567L, 814161885590044357190593282132583612817366020133424034468187008267919006610450334193936389251944312061685926620628676079561886595567219325737685515818965422518820810326234612624290774570873983198113409686391355443155606621049101005048872030700143084978689888823664771959905075795440800042648923901406744546140059930315752131296763893979780940230041254506456283030727953969468933552050776243515721233426119581636614777596169466339421956338478341355508343072697451L, 17101222758731850777
from sage.all import *
import base64
def factor(n,b):
M=1
print 'start'
a = 2
i=0
for q in primes(b):
i+=1
@hellman
hellman / 0_solve.py
Created September 10, 2017 18:42
ASIS CTF 2017 Finals - Marijuana (Crypto 394)
#-*- coding:utf-8 -*-
'''
In the challenge we are given a recently proposed cryptosystem
based on Mersenne primes ( https://eprint.iacr.org/2017/481 ).
The cryptosystem was broken quickly in https://eprint.iacr.org/2017/522.pdf
using random partitioning and LLL. Here this attack is implemented.
'''
@hellman
hellman / Flag.java
Last active June 19, 2017 09:34
Google CTF 2017 Quals - Bleichenbacher’s Lattice Task - Insanity Check
/**
* Print a Flag.
* @author Daniel Bleichenbacher
*/
package blt;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.security.GeneralSecurityException;
@hellman
hellman / rsa_timing_attack_d_Montgomery.py
Created May 1, 2017 12:23
DEF CON 2017 Quals - Godzilla (Reverse/Crypto)
#-*- coding:utf-8 -*-
'''
DEF CON 2017 Quals - Godzilla (Reverse)
Timing attack on RSA decryption.
Based on http://www.cs.jhu.edu/~fabian/courses/CS600.624/Timing-full.pdf
Another solutions:
https://gist.github.com/nneonneo/367240ae2d8e705bb9173a49a7c8b0cd by b2xiao
https://gist.github.com/Riatre/caac24840b176cf843b3f66ad9a5eeaf by riatre
@hellman
hellman / bivariate_polynomial_modulo_N.py
Created April 24, 2017 13:53
PlaidCTF 2017 - Common (Crypto 600)
'''
Common-prime (in group order!) RSA with low private exponent.
p = 2ga + 1
q = 2gb + 1
N = p * q
phi(N) = 2gab
'''
from sage.all import *