-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add
svdw_map_to_curve_test
helper in mod tests
- Loading branch information
Showing
6 changed files
with
108 additions
and
136 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,2 +1,17 @@ | ||
use ff::PrimeField; | ||
use num_bigint::BigUint; | ||
use num_traits::Num; | ||
use std::borrow::Cow; | ||
|
||
pub mod curve; | ||
pub mod field; | ||
|
||
pub(crate) fn fe_from_str<F: PrimeField>(string: impl AsRef<str>) -> F { | ||
let string = string.as_ref(); | ||
let oct = if let Some(hex) = string.strip_prefix("0x") { | ||
Cow::Owned(BigUint::from_str_radix(hex, 16).unwrap().to_string()) | ||
} else { | ||
Cow::Borrowed(string) | ||
}; | ||
F::from_str_vartime(&oct).unwrap() | ||
} |