1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::{
    elliptic_curve::{
        montgomery::{point::MontgomeryProjectivePoint, traits::IsMontgomery},
        traits::IsEllipticCurve,
    },
    field::{element::FieldElement, fields::u64_prime_field::U64PrimeField},
};

/// Taken from moonmath manual page 91
#[derive(Debug, Clone)]
pub struct TinyJubJubMontgomery;

impl IsEllipticCurve for TinyJubJubMontgomery {
    type BaseField = U64PrimeField<13>;
    type PointRepresentation = MontgomeryProjectivePoint<Self>;

    fn generator() -> Self::PointRepresentation {
        Self::PointRepresentation::new([
            FieldElement::from(3),
            FieldElement::from(5),
            FieldElement::one(),
        ])
    }
}

impl IsMontgomery for TinyJubJubMontgomery {
    fn a() -> FieldElement<Self::BaseField> {
        FieldElement::from(6)
    }

    fn b() -> FieldElement<Self::BaseField> {
        FieldElement::from(7)
    }
}