Skip to content

Commit

Permalink
Add DivisorCurve impl to Helios and Selene
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed May 4, 2024
1 parent ad6a8b6 commit ae34f0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crypto/helioselene/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ crypto-bigint = { version = "0.5", default-features = false, features = ["zeroiz

dalek-ff-group = { path = "../dalek-ff-group", version = "0.4.1", default-features = false, features = ["std"] }

ec-divisors = { path = "../divisors" }

[dev-dependencies]
hex = "0.4"

Expand Down
16 changes: 16 additions & 0 deletions crypto/helioselene/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,22 @@ macro_rules! curve {
}

impl PrimeGroup for $Point {}

impl ec_divisors::DivisorCurve for $Point {
type FieldElement = $Field;

fn a() -> Self::FieldElement {
-$Field::from(3u64)
}
fn b() -> Self::FieldElement {
B
}

fn to_xy(point: Self) -> (Self::FieldElement, Self::FieldElement) {
let z = point.z.invert().unwrap();
(point.x * z, point.y * z)
}
}
};
}

Expand Down

0 comments on commit ae34f0a

Please sign in to comment.