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

Field classes public members are accessible via target group element #37

Open
AntoineRondelet opened this issue Apr 2, 2020 · 0 comments

Comments

@AntoineRondelet
Copy link
Collaborator

AntoineRondelet commented Apr 2, 2020

Looks like the target groups of the pairings are defined from fields via typedef directives.
See here for eg:
https://github.com/scipr-lab/libff/blob/master/libff/algebra/curves/mnt/mnt4/mnt4_init.hpp#L39

This means that all public members of the underlying field type are accessible via any variable of type GT_type.
This fails to account for the structural differences of the algebraic structures (G_T is a group defined as the multiplicative subgroup of a field (F_{q^k} in the example above, where the embedding degree = 4))

I think defining the target groups as classes that would be "wrappers" around the appropriate methods of the underlying field would be clearer, and would remove the possibility to access the public members of the field class from the group elements.

Something like:

class mnt4_GT {
public:
    mnt4_Fq4 element;

    mnt4_GT();
    mnt4_GT(const my_Fp2& c0, const my_Fp2& c1) : element(c0, c1) {};

    // The group is defined via wrappers around the relevant methods of the field it is "extracted from"
    mnt4_GT operator*(const mnt4_GT &other) const { return this->element * other.element; }
    ....

Happy to open a PR later on to take care of that if you agree that this would be worth doing.

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

No branches or pull requests

1 participant