Skip to content

Instantly share code, notes, and snippets.

@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
@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.
@hyunsikjeong
hyunsikjeong / solver.sage
Created November 6, 2019 16:38
Multivariate Coppersmith method
class IIter:
def __init__(self, m, n):
self.m = m
self.n = n
self.arr = [0 for _ in range(n)]
self.sum = 0
self.stop = False
def __iter__(self):
return self
@sea0h7e
sea0h7e / 0_sol.sage
Created October 17, 2019 11:56
HITCON CTF 2019 Quals - not so hard RSA (Crypto, 371pts, 6 solves)
# https://pdfs.semanticscholar.org/2d85/9e8937fe652558a60e82ffd39cd4ab835e31.pdf, Section4.4
# As LLL is not precise for there are only 10 public keys, so I use Babai instead.
# Just randomly construct the target vector, if it is close enough to (dM, 1−k1Λ1, ..., 1−krΛr), we may recover d.
from Crypto.Util.number import *
import random
k = 10
f = open('output', 'rb')
f.readline()
@stefan1wan
stefan1wan / debug_libc.md
Last active July 26, 2019 10:50
调试libc
@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 *