-
Notifications
You must be signed in to change notification settings - Fork 170
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 weierstrass::FixedBaseScalarMul
trait
#49
Merged
Merged
Changes from all commits
Commits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
coverage: | ||
status: | ||
patch: off | ||
project: off |
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
pub mod field; | ||
pub mod group; | ||
pub mod mul_base; |
This file contains 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,44 @@ | ||
//! Fixed-base scalar multiplication test vectors for secp256k1 | ||
|
||
/// Fixed-base scalar multiplication test vector | ||
pub struct MulBaseVector { | ||
/// Random value modulo the curve order n | ||
pub m: &'static str, | ||
|
||
/// Resulting x-coordinate after scalar multiplication | ||
pub x: &'static str, | ||
|
||
/// Resulting y-coordinate after scalar multiplication | ||
pub y: &'static str, | ||
} | ||
|
||
/// Vectors for secp256k1 are difficult to find. Fortunately Thomas Pornin | ||
/// made some and he seems to know a thing or two about cryptography: | ||
/// <https://crypto.stackexchange.com/a/787> | ||
pub const MUL_BASE_TEST_VECTORS: &[MulBaseVector] = &[ | ||
MulBaseVector { | ||
m: "AA5E28D6A97A2479A65527F7290311A3624D4CC0FA1578598EE3C2613BF99522", | ||
x: "34F9460F0E4F08393D192B3C5133A6BA099AA0AD9FD54EBCCFACDFA239FF49C6", | ||
y: "0B71EA9BD730FD8923F6D25A7A91E7DD7728A960686CB5A901BB419E0F2CA232", | ||
}, | ||
MulBaseVector { | ||
m: "7E2B897B8CEBC6361663AD410835639826D590F393D90A9538881735256DFAE3", | ||
x: "D74BF844B0862475103D96A611CF2D898447E288D34B360BC885CB8CE7C00575", | ||
y: "131C670D414C4546B88AC3FF664611B1C38CEB1C21D76369D7A7A0969D61D97D", | ||
}, | ||
MulBaseVector { | ||
m: "6461E6DF0FE7DFD05329F41BF771B86578143D4DD1F7866FB4CA7E97C5FA945D", | ||
x: "E8AECC370AEDD953483719A116711963CE201AC3EB21D3F3257BB48668C6A72F", | ||
y: "C25CAF2F0EBA1DDB2F0F3F47866299EF907867B7D27E95B3873BF98397B24EE1", | ||
}, | ||
MulBaseVector { | ||
m: "376A3A2CDCD12581EFFF13EE4AD44C4044B8A0524C42422A7E1E181E4DEECCEC", | ||
x: "14890E61FCD4B0BD92E5B36C81372CA6FED471EF3AA60A3E415EE4FE987DABA1", | ||
y: "297B858D9F752AB42D3BCA67EE0EB6DCD1C2B7B0DBE23397E66ADC272263F982", | ||
}, | ||
MulBaseVector { | ||
m: "1B22644A7BE026548810C378D0B2994EEFA6D2B9881803CB02CEFF865287D1B9", | ||
x: "F73C65EAD01C5126F28F442D087689BFA08E12763E0CEC1D35B01751FD735ED3", | ||
y: "F449A8376906482A84ED01479BD18882B919C140D638307F0C0934BA12590BDE", | ||
}, | ||
]; |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to eliminate the
Default
bound onAffinePoint
by having this return anOption
rather than aCtOption
as soon as scalar multiplication is complete (i.e. unwrapping theCtOption
containing the public key).Since we're dealing with a public key after scalar multiplication is complete, this seems ok to me.