Skip to content

Commit 45f3846

Browse files
committed
update readme
1 parent 8c182ef commit 45f3846

File tree

1 file changed

+81
-5
lines changed

1 file changed

+81
-5
lines changed

README.md

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,92 @@
1-
# Isogeny
1+
# A Rust Isogeny Library
22

33
A Rust library for isogeny-based cryptography
44

55
## :construction: Everything will Change Always :construction:
66

7-
At the moment, this repo is a bit of a dump of various previous projects. If you're interested in collaborating, get in touch, but there's a lot to figure out before collaboration becomes easier!
7+
Currently this code is "pre-alpha" in that in development of new features, the code is being constantly refactored. Don't expect any of the current code to maintain API / form.
8+
9+
## Motivation
10+
11+
Over the past few years, I've written some Rust for isogeny-based research papers which have now become spread over several GitHub repositories. The aim with this project is to collect all this work into one library with a consistent API.
12+
13+
The hope is that after enough work, this library makes implementing new protocols in Rust more easily. This is helped thanks to the finite field macro: [`fp2`](https://github.com/GiacomoPope/fp2) which allows the easy creation of any field $GF(p^2)$ with modulus $x^2 + 1$ requiring only `p` encoded as little endian `u64` for creation.
14+
15+
## Protocols
16+
17+
This library currently contains:
18+
19+
- SQIsign verification following the [SQIsign spec](https://sqisign.org)
20+
- A toy implementation of SIDH to demonstrate 2-isogenies and 3-isogenies
821

922
## Associated Work
1023

1124
This repository has started as a collection and refactoring of some isogeny-based cryptography research papers.
1225

13-
- "Simpler and faster pairings from the Montgomery Ladder" by Giacomo Pope, Krijn Reijnders, Damien Robert, Alessandro Sferlazza and Benjamin Smith.
14-
- https://eprint.iacr.org/2025/672
15-
- https://github.com/GiacomoPope/cubical-pairings/
1626
- "An Algorithmic Approach to (2, 2)-isogenies in the Theta Model and Applications to Isogeny-based Cryptography" by Pierrick Dartois, Luciano Maino, Giacomo Pope, and Damien Robert.
1727
- https://eprint.iacr.org/2023/1747
1828
- https://github.com/ThetaIsogenies/two-isogenies
29+
- "Simpler and faster pairings from the Montgomery Ladder" by Giacomo Pope, Krijn Reijnders, Damien Robert, Alessandro Sferlazza and Benjamin Smith.
30+
- https://eprint.iacr.org/2025/672
31+
- https://github.com/GiacomoPope/cubical-pairings/
32+
33+
## SIDH Example
34+
35+
As a small example, SIDH key exchange is relatively compact and easy to read
36+
37+
```rs
38+
pub fn keygen_alice<R: CryptoRng + RngCore>(
39+
self,
40+
rng: &mut R,
41+
) -> (SidhAlicePublicKey<Fq>, SidhAlicePrivateKey<Fq, N>) {
42+
// Sample a secret key, which is an array of bytes used as a scalar to
43+
// generate a kernel
44+
let scalar = Self::sample_secret_key(rng);
45+
46+
// The domain E0 : y^2 = x^3 + 6x^2 + x
47+
let E = Self::starting_curve();
48+
49+
// Compute the kernel K2 = P2 + [s]Q2
50+
let kernel = E.three_point_ladder(&self.two_torsion, &scalar, N << 3);
51+
52+
// Compute phi_2 : E0 -> E/<K2> and phi_2(P3), phi_2(Q3), phi_2(P3 - Q3)
53+
// We ignore the check during keygen as the parameters are trusted.
54+
let mut three_torsion_img = self.three_torsion.to_array();
55+
let (codomain, _) = E.two_isogeny_chain(&kernel, self.ea, &mut three_torsion_img);
56+
57+
// Package the data above into public and private keys
58+
let public_key = SidhAlicePublicKey::new(&codomain, &three_torsion_img);
59+
let secret_key = SidhAlicePrivateKey::new(self.ea, scalar);
60+
(public_key, secret_key)
61+
}
62+
```
63+
64+
and made to emulate the maybe more familiar SageMath API:
65+
66+
```py
67+
p = 2^216 * 3^137 - 1
68+
Fp2.<i> = GF(p^2, modulus=x^2+1)
69+
E = EllipticCurve(Fp2, [0, 6, 0, 1, 0])
70+
P, Q = E.gens()
71+
P2, Q2 = 3^137 * P, 3^137 * Q
72+
P3, Q3 = 2^216 * P, 2^216 * Q
73+
74+
def alice_keygen(E, P2, Q2, P3, Q3):
75+
s = randint(0, 2**224)
76+
k = P2 + s*Q2
77+
phi = E.isogeny(k, algorithm="factored")
78+
return phi.codomain(), phi(P3), phi(Q3)
79+
```
80+
81+
with the benefit of being signficiantly faster (run `cargo bench`):
82+
83+
```
84+
Benchmarking Alice Keygen for SIKE434 Parameters
85+
time: [4.6825 ms 4.6870 ms 4.6913 ms]
86+
87+
sage: %timeit alice_keygen(E, P2, Q2, P3, Q3)
88+
1.17 s ± 6.48 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
89+
```
1990

2091
### Tests
2192

@@ -29,3 +100,8 @@ cargo test
29100

30101
[build-image]: https://github.com/GiacomoPope/isogeny_rs/workflows/Rust/badge.svg
31102
[build-link]: https://github.com/GiacomoPope/isogeny_rs/actions?query=workflow%3ARust
103+
104+
105+
## Collaboration
106+
107+
I am very interested in collaboration to improve both the performance and scope of this project. Additionally, I am a mathematican first and Rust person second, so if any Rust experts have opinions / advice of making this project more idomatic to a Rust developer, please let me know.

0 commit comments

Comments
 (0)