Auto merge of #51 - ebfull:several-fixups, r=ebfull
Several fixups Closes #50 Closes #48 Closes #46 Also, CI changes this PR will test: Closes #43 Closes #44
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pairing"
|
name = "pairing"
|
||||||
|
|
||||||
|
# Remember to change version string in README.md.
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
@@ -17,4 +19,4 @@ clippy = { version = "0.0.151", optional = true }
|
|||||||
[features]
|
[features]
|
||||||
unstable-features = []
|
unstable-features = []
|
||||||
u128-support = []
|
u128-support = []
|
||||||
default = ["u128-support"]
|
default = []
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -4,6 +4,20 @@ This is a Rust crate for using pairing-friendly elliptic curves. Currently, only
|
|||||||
|
|
||||||
## [Documentation](https://docs.rs/pairing/)
|
## [Documentation](https://docs.rs/pairing/)
|
||||||
|
|
||||||
|
Bring the `pairing` crate into your project just as you normally would.
|
||||||
|
|
||||||
|
If you're using a supported platform and the nightly Rust compiler, you can enable the `u128-support` feature for faster arithmetic.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies.pairing]
|
||||||
|
version = "0.11"
|
||||||
|
features = ["u128-support"]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Security Warnings
|
||||||
|
|
||||||
|
This library does not make any guarantees about constant-time operations, memory access patterns, or resistance to side-channel attacks.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Licensed under either of
|
Licensed under either of
|
||||||
|
|||||||
@@ -415,7 +415,10 @@ impl ::rand::Rand for Fq {
|
|||||||
fn rand<R: ::rand::Rng>(rng: &mut R) -> Self {
|
fn rand<R: ::rand::Rng>(rng: &mut R) -> Self {
|
||||||
loop {
|
loop {
|
||||||
let mut tmp = Fq(FqRepr::rand(rng));
|
let mut tmp = Fq(FqRepr::rand(rng));
|
||||||
tmp.0.divn(REPR_SHAVE_BITS);
|
|
||||||
|
// Mask away the unused bits at the beginning.
|
||||||
|
tmp.0.as_mut()[5] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
|
||||||
|
|
||||||
if tmp.is_valid() {
|
if tmp.is_valid() {
|
||||||
return tmp
|
return tmp
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,10 @@ impl ::rand::Rand for Fr {
|
|||||||
fn rand<R: ::rand::Rng>(rng: &mut R) -> Self {
|
fn rand<R: ::rand::Rng>(rng: &mut R) -> Self {
|
||||||
loop {
|
loop {
|
||||||
let mut tmp = Fr(FrRepr::rand(rng));
|
let mut tmp = Fr(FrRepr::rand(rng));
|
||||||
tmp.0.divn(REPR_SHAVE_BITS);
|
|
||||||
|
// Mask away the unused bits at the beginning.
|
||||||
|
tmp.0.as_mut()[3] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
|
||||||
|
|
||||||
if tmp.is_valid() {
|
if tmp.is_valid() {
|
||||||
return tmp
|
return tmp
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ impl<G: CurveProjective> Wnaf<(), Vec<G>, Vec<i64>> {
|
|||||||
// Return a Wnaf object that immutably borrows the computed base storage location,
|
// Return a Wnaf object that immutably borrows the computed base storage location,
|
||||||
// but mutably borrows the scalar storage location.
|
// but mutably borrows the scalar storage location.
|
||||||
Wnaf {
|
Wnaf {
|
||||||
base: &self.base,
|
base: &self.base[..],
|
||||||
scalar: &mut self.scalar,
|
scalar: &mut self.scalar,
|
||||||
window_size: window_size
|
window_size: window_size
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ impl<G: CurveProjective> Wnaf<(), Vec<G>, Vec<i64>> {
|
|||||||
// immutably borrows the computed wNAF form scalar location.
|
// immutably borrows the computed wNAF form scalar location.
|
||||||
Wnaf {
|
Wnaf {
|
||||||
base: &mut self.base,
|
base: &mut self.base,
|
||||||
scalar: &self.scalar,
|
scalar: &self.scalar[..],
|
||||||
window_size: window_size
|
window_size: window_size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user