-
Generating Cryptographic Primes in Rust
This is a draft post. There may be some rough edges, but the core content is here. Feedback is welcome!
Many cryptographic schemes rely on large prime numbers for their security. RSA needs two of them. Diffie-Hellman needs one. DSA, ElGamal, Paillier — primes everywhere. Cryptographic libraries need to generate these primes efficiently and securely when producing keypairs. In this post, we’ll learn how these primes are generated, and implement our own in Rust.
-
A Music Engine in $\mathbb{Z}_{12}$
This project began as a tool for visualizing chord shapes and progressions on a guitar fretboard, while being able to easily switch between different tunings.
It’s evolving into a more general music engine that can be used to explore various musical concepts, but the initial motivation was to have a tool to help me understand how different tunings work on the guitar.
The core insight is that music can be represented using modular arithmetic! In particular, the 12 notes in the chromatic scale can be represented as elements of the group $\mathbb{Z}_{12}$, which is the integers modulo 12. This allows us to use mathematical operations to manipulate musical concepts like chords and scales.
-
The Discrete Logarithm Problem
The discrete logarithm problem (DLP) is a fundamental problem in group theory that underpins the security of many cryptographic systems, including elliptic curve cryptography and the Diffie-Hellman key exchange.
In a cyclic group $G$ with generator $g$, every element $h\in G$ can be expressed as $h=g^x$ for some integer $x$. Computing $g^x$ given $g$ and $x$ is fast and efficient – $\mathcal O(\log x)$ using the method of repeated squaring.
The inverse problem, however – given $g$ and $h=g^x$, find $x$ – is believed to be computationally hard in certain groups. We haven’t proven that it’s hard (P vs NP is still an open problem), but we have decades of cryptanalysis and no known efficient algorithms for solving DLP in well-chosen groups, which gives us confidence in its hardness.
-
DLL Injection

DLL Injection is an exploit technique that can be used for anything from harmless game mods to sophisticated malware campaigns. At its core, DLL Injection is about convincing a running process to execute code it never intended to run - whether that’s adding custom features to your favorite game, or establishing persistence in a compromised system.
As part of my Infosec studies, I decided I would spend today diving deeper into DLLs, and learn about how they can be used to exploit Windows machines. Here are some of my key takeaways.
-
Cosmos SDK Gas Metering
One challenge of implementing Monomer is creating a standard for how gas is metered and handled. By metered we mean both tracked and calculated. By handled we mean how fees are checked and ultimately deducted.
On the Monomer side, the problem we want to solve is two-fold:
- Exempting the first transaction of every block from gas fees (the first tx in each block are Layer-1 deposits).
- Translating the gas limit from the Engine API’s
PayloadAttributesto the Cosmos SDK.
To tackle this problem, we need to take a step back and understand how gas is handled in the Cosmos SDK; first at a high-level, and then at a more granular implementation-level.
-
Archives
Here is stored archival copies of various texts, writings, and other content that you can find in other places on the internet. This is meant to be a way to preserve content that may be lost or deleted elsewhere. But also to enrich my hypertext garden by enabling my writing to form relationships with other writings through backlinks and other hypertextual features.