Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ecdh #199

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

add ecdh #199

wants to merge 10 commits into from

Conversation

jtriley2p
Copy link
Contributor

diffs

added:

  • ecdh module
  • thicc readme
  • fn to compute shared secret over a FiniteField and CurveGroup
  • fn to compute point pair wrt tripartite ecdh over PlutoScalarField and Pluto*Curve types
  • fn to compute tripartite shared secret over PlutoScalarField and Pluto*Curve types

notes:

i used PlutoScalarField and Pluto*Curve types bc the pairing fn takes a finer type than CurveGroup. maybe there's a better type to use?

also, base ecdh passes smoke check, tp_ecdh does not. perhaps it's a math bug on my end? it's computed atm as follows.

$$a, b, c \in \mathbb{F}_p$$

$$[a]P, [b]P, [c]P \in E(\mathbb{F}_p)$$

$$[a]Q, [b]Q, [c]Q \in E(\mathbb{F}_{p^2})$$

$$e([b]P, [c]Q)^a = e([a]P, [c]Q)^b = e([a]P, [b]Q)^c$$

closes #81

Copy link
Contributor

@Autoparallel Autoparallel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just nitted the living hell out of you -- sorry.

This is looking really good. I notice your comment about groups/curves/types. Is there a change you have in mind? Ronk has grown a bit and I do think we could stand a refactor to simplify and clean up. I'm finding our interfaces are just not quite there.

What specifically do we need? A pairing friendly curve type? Perhaps we can make a finer grained trait or something:

pub trait PairingCurve: EllipticCurve { .. }

src/dh/README.md Outdated Show resolved Hide resolved
src/dh/README.md Outdated Show resolved Hide resolved
src/dh/README.md Show resolved Hide resolved
src/dh/README.md Outdated Show resolved Hide resolved
src/dh/ecdh.rs Outdated Show resolved Hide resolved
src/dh/tp_ecdh.rs Outdated Show resolved Hide resolved
@jtriley2p
Copy link
Contributor Author

jtriley2p commented Jan 30, 2025

re: types

tbh there's a few directions we could go, depends on how absurd you wanna go w it. like breaking out pairing types & having diff curves compatible w diff pairing types. ie SuperSingular for Type1Pairing, etcetc

but that may be a lil too funky for a simple educational resource

i'm down to just use the more fine type for now

@jtriley2p jtriley2p marked this pull request as ready for review January 30, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Diffie-Hellman and elliptic curve DH
2 participants