
I’ll be honest: when I first took Algebra, I had no idea why we were spending weeks on groups, rings, and fields. As a CS student, I kept thinking “when am I ever going to use this stuff?” Turns out, the answer was everywhere in cryptography.
The Basics
Let’s start simple. A group $(G,\cdot)$ is just a set with an operation that plays nicely. It needs to be closed (stay within the set), associative (grouping doesn’t matter), have an identity element, and every element needs an inverse.
The interesting part is when you map between groups while preserving their structure. This is called a homomorphism:
$$\phi : G \rightarrow H \text{ such that } \phi(a \cdot b) = \phi(a) \star \phi(b)$$
This structure preservation is actually the backbone of many cryptographic systems. Here’s how you might implement this:
1 | from typing import TypeVar, Generic, Callable |
Computing on Encrypted Data
Here’s where things get really cool. Homomorphic encryption lets you do math on encrypted data without ever decrypting it. The math behind it uses ring homomorphisms where both addition and multiplication are preserved:
$$E(x + y) = E(x) \oplus E(y) \text{ and } E(x \cdot y) = E(x) \otimes E(y)$$
Here’s a basic version of how this might work:
1 | from dataclasses import dataclass |
Why Public Key Crypto Actually Works
Most public key cryptography relies on problems that are easy to compute one way but hard to reverse. Take the discrete logarithm problem:
$$\text{Given } g^x \equiv h \pmod{p}, \text{ find }x$$
Computing $g^x \bmod p$ is straightforward, but finding $x$ when you only know $g$, $h$, and $p$ is computationally brutal for large primes. This difficulty gap is what keeps your encrypted messages safe.
Connecting the Dots
The thing that finally clicked for me was realizing that the same mathematical patterns show up everywhere. Group theory helps us understand molecular structures and also builds secure communication systems. It’s not a coincidence.
After spending way too many late nights in the NTNU library, I started seeing these connections everywhere. What began as “just another required math course” turned into understanding how the same fundamental patterns work across completely different fields. The abstract becomes practical when you see how these mathematical structures actually solve real problems.
That’s what I find most interesting about this stuff. It’s not just theory for theory’s sake. These mathematical tools give us a way to spot the underlying patterns that connect seemingly unrelated problems, whether that’s in cryptography, physics, or computer science.