Skip to content

Instantly share code, notes, and snippets.

@Yu212
Yu212 / solver.py
Created May 21, 2025 04:38
Yajilin solver with gurobipy
import random
from collections import namedtuple
import time
import gurobipy as gp
from gurobipy import GRB
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import json
with open("gurobi.lic", "r") as f:
#import "@preview/cetz:0.2.0"
#let proof(root) = {
cetz.canvas({
import cetz.draw: *
let min(..a) = {
let a = a.pos().filter(v => v != none)
return calc.min(..a)
}
@Yu212
Yu212 / small_secret_exponent_attack.sage
Last active January 15, 2024 17:01
Small Secret Exponent Attack
from math import sqrt, ceil, gcd, comb, log, exp
import subprocess
import time
def gen(size, delta_list):
while True:
p = random_prime(2^(size//2), lbound=2^(size//2-1))
q = random_prime(2^(size//2), lbound=2^(size//2-1))
if gcd(p-1, q-1) == 2: