Skip to content

Instantly share code, notes, and snippets.

View MurageKibicho's full-sized avatar
🛼
Working from home

Murage Kibicho MurageKibicho

🛼
Working from home
  • Yale University
  • New Haven, Connnecticut
  • 02:09 (UTC -04:00)
View GitHub Profile
@MurageKibicho
MurageKibicho / XML.c
Last active July 24, 2026 14:58
Hutter Prize Enwik XML Parsing
//Full guide : https://leetarxiv.substack.com/p/writing-a-wikipedia-mediawiki-parser
//This code assumes access to Enwik8 and "English.dic" file in https://github.com/kaitz/fxcm/tree/main
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <sys/mman.h>
#include <stdbool.h>
@MurageKibicho
MurageKibicho / algebraic.py
Created July 21, 2026 12:41
algebraic sex intelligence or ASI for short
A = -11780958793495227915671392185849473
B = 2967966474637168250591643503811845
T = 22760185083691921160273336139
V = -48454067936694480117959482723
p = 5213619424271520371687014113170182341777563603680354416779
s = 674628418031497608859095525797188659682765178381388426867
@MurageKibicho
MurageKibicho / LSBBias.py
Last active May 18, 2026 07:39
LSB Bias for Bleichenbacher
import random
import cmath
MOD = 1 << 20
samples = 10000
FIXED_LSBS = 3
# Generate nonces with FIXED_LSBS LSBs = 0
step = 1 << FIXED_LSBS
max_val = MOD // step
@MurageKibicho
MurageKibicho / CSV.py
Last active February 6, 2026 13:08
CADO-NFS Script
#CADO Dataset Creator
#Read data file 55
import csv
import math
import subprocess
start = 0
end = 0
datasetIndex = 0
cadoFolder = "/home/mint/cado-nfs/build/mint"
cadoScript = "cado-nfs.py"
@MurageKibicho
MurageKibicho / ComplexPrimitiveRoot.c
Last active December 9, 2025 23:31
Find Complex Primitive Root of Eisenstein Number
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
#include <time.h>
#include <math.h>
#include <gmp.h>
#include <flint/flint.h>
@MurageKibicho
MurageKibicho / Murage_Eisenstein.c
Created December 9, 2025 09:58
Convert prime number to eisenstein prime using Cornacchia's algorithm
//Convert prime number to eisenstein prime using Cornacchia's algorithm
//Described in https://leetarxiv.substack.com/p/computation-of-discrete-logarithms
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
#include <time.h>
#include <math.h>
@MurageKibicho
MurageKibicho / Eisenstein.c
Created December 6, 2025 12:12
Arithmetic with Eisenstein numbers
//https://github.com/RasmusFL/EisensteinIntegers/blob/main/EisensteinIntegers/eisenstein_integers.cpp
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
#include <time.h>
#include <math.h>
#include <gmp.h>
@MurageKibicho
MurageKibicho / GaussReduce.c
Created December 5, 2025 08:08
2D Gaussian lattice reduction
void GaussReduce(fmpz_t x1, fmpz_t y1, fmpz_t x2, fmpz_t y2)
{
//Shortest solution is stored in x1,y1
fmpz_t mu, dot12, dot11, tmp,tmp2,tmp3;
fmpz_init(mu);fmpz_init(tmp2);fmpz_init(tmp3); fmpz_init(dot12); fmpz_init(dot11); fmpz_init(tmp);
int infiniteLoopCheck = 0;
while(1)
{
//mu = round((v1·v2)/(v1·v1))
fmpz_mul(dot12, x1, x2);fmpz_mul(tmp, y1, y2);fmpz_add(dot12, dot12, tmp);
@MurageKibicho
MurageKibicho / Cornacchia.py
Created December 4, 2025 19:31
Cornacchia's algorithm for Gaussian Integers paper
#Complete walkthrough: https://leetarxiv.substack.com/p/computation-of-discrete-logarithms
import sympy as sp
p = sp.Integer("5213619424271520371687014113170182341777563603680354416779")
# Step 1: find root of -2 mod p
r = sp.sqrt_mod(-2, p, all_roots=False) # choose one root
if r is None:
raise ValueError("No solution exists.")
@MurageKibicho
MurageKibicho / Fold.py
Created November 27, 2025 06:02
Folding Bit Tracker
import random
import math
p = 2**256 - 2**32 - 977
def pseudo_mersenne_reduce(x, p):
# Split into high and low 256-bit parts
x_low = x & ((1 << 256) - 1)
x_high = x >> 256
# First fold: add high * (2^32 + 977)