Skip to content

Instantly share code, notes, and snippets.

@lmyyao
Created July 29, 2024 02:58
Show Gist options
  • Save lmyyao/2b19cbbb8ef5540c1a28e03a8557f153 to your computer and use it in GitHub Desktop.
Save lmyyao/2b19cbbb8ef5540c1a28e03a8557f153 to your computer and use it in GitHub Desktop.
SIDH key exchange
### SIDH
### https://nbviewer.org/url/defeo.lu/docet/assets/jupyter/2018-03-22-PostScryptum.ipynb
p = 431
F.<i> = GF(p^2, modulus=x^2+1)
E = EllipticCurve(F, [1, 0])
E.order() == (p+1)^2
p + 1 == 2^4 * 3^3
Pa, Qa = E.torsion_basis(2^4)
Pb, Qb = E.torsion_basis(3^3)
Sa = randint(1, 2^4)
Sb = randint(1, 3^3)
phi_a = E.isogeny(Pa + Sa * Qa)
phi_b = E.isogeny(Pb + Sb * Qb)
Ea = phi_a.codomain()
Eb = phi_b.codomain()
phi_a(Pb) + Sb * phi_a(Qb) == phi_a(Pb + Sb * Qb)
phi_b(Pa) + Sa * phi_b(Qa) == phi_b(Pa + Sa * Qa)
Eab = Ea.isogeny(phi_a(Pb + Sb * Qb)).codomain()
Eba = Eb.isogeny(phi_b(Pa + Sa * Qa)).codomain()
Eab == Eba == E.isogeny([Pa + Sa * Qa, Pb + Sb * Qb])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment