-
Notifications
You must be signed in to change notification settings - Fork 400
Add GLVParameters trait definition
#301
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9965ac8
adding GLV parameters trait
zhenfeizhang 33aed53
update change log
zhenfeizhang dc280b2
improve API
zhenfeizhang 1c57645
polishing description
zhenfeizhang 92b25a4
cargo fmt
zhenfeizhang 5355c3d
clear typo
zhenfeizhang 461a0fb
more description
zhenfeizhang 97a7977
Merge branch 'master' into master
weikengchen 9d5106c
fmt
weikengchen 9f8b424
update the CHANGELOG + align the style of a few EC files
weikengchen 11d0f14
style
weikengchen a45caa4
tune the fmt
weikengchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| use crate::ModelParameters; | ||
|
|
||
| /// The GLV parameters that are useful to compute the endomorphism | ||
| /// and scalar decomposition. | ||
| pub trait GLVParameters: Send + Sync + 'static + ModelParameters { | ||
| type CurveAffine; | ||
| type CurveProjective; | ||
|
|
||
| // phi(P) = lambda*P for all P | ||
| // constants that are used to calculate phi(P) | ||
| const COEFF_A1: Self::BaseField; | ||
|
weikengchen marked this conversation as resolved.
|
||
| const COEFF_A2: Self::BaseField; | ||
| const COEFF_A3: Self::BaseField; | ||
| const COEFF_B1: Self::BaseField; | ||
| const COEFF_B2: Self::BaseField; | ||
| const COEFF_B3: Self::BaseField; | ||
| const COEFF_C1: Self::BaseField; | ||
| const COEFF_C2: Self::BaseField; | ||
|
|
||
| // constants that are used to perform scalar decomposition | ||
| // This is a matrix which is practically the LLL reduced bases | ||
| const COEFF_N11: Self::ScalarField; | ||
| const COEFF_N12: Self::ScalarField; | ||
| const COEFF_N21: Self::ScalarField; | ||
| const COEFF_N22: Self::ScalarField; | ||
|
|
||
| /// mapping a point G to phi(G):= lambda G where psi is the endomorphism | ||
| fn endomorphism(base: &Self::CurveAffine) -> Self::CurveAffine; | ||
|
|
||
| /// decompose a scalar s into k1, k2, s.t. s = k1 + lambda k2 | ||
| fn scalar_decomposition(k: &Self::ScalarField) -> (Self::ScalarField, Self::ScalarField); | ||
|
|
||
| /// perform GLV multiplication | ||
| fn glv_mul(base: &Self::CurveAffine, scalar: &Self::ScalarField) -> Self::CurveProjective; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.