Skip to content

Commit

Permalink
Fix up imports in doctests & benches
Browse files Browse the repository at this point in the history
  • Loading branch information
hdevalence committed Jan 28, 2021
1 parent f787575 commit 6ba15aa
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 47 deletions.
3 changes: 2 additions & 1 deletion benches/dalek_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ extern crate criterion;
use criterion::BatchSize;
use criterion::Criterion;

extern crate curve25519_dalek;
extern crate curve25519_dalek_ng;
use curve25519_dalek_ng as curve25519_dalek;

use curve25519_dalek::constants;
use curve25519_dalek::scalar::Scalar;
Expand Down
4 changes: 2 additions & 2 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
//! scope using a `let` binding:
//!
//! ```
//! use curve25519_dalek::constants;
//! use curve25519_dalek::traits::IsIdentity;
//! use curve25519_dalek_ng::constants;
//! use curve25519_dalek_ng::traits::IsIdentity;
//!
//! let B = &constants::RISTRETTO_BASEPOINT_TABLE;
//! let l = &constants::BASEPOINT_ORDER;
Expand Down
4 changes: 2 additions & 2 deletions src/edwards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ impl EdwardsPoint {
/// # Example
///
/// ```
/// use curve25519_dalek::constants;
/// use curve25519_dalek_ng::constants;
///
/// // Generator of the prime-order subgroup
/// let P = constants::ED25519_BASEPOINT_POINT;
Expand Down Expand Up @@ -901,7 +901,7 @@ impl EdwardsPoint {
/// # Example
///
/// ```
/// use curve25519_dalek::constants;
/// use curve25519_dalek_ng::constants;
///
/// // Generator of the prime-order subgroup
/// let P = constants::ED25519_BASEPOINT_POINT;
Expand Down
20 changes: 10 additions & 10 deletions src/ristretto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ impl RistrettoPoint {
/// in a batch.
///
/// ```
/// # extern crate curve25519_dalek;
/// # use curve25519_dalek::ristretto::RistrettoPoint;
/// # extern crate curve25519_dalek_ng;
/// # use curve25519_dalek_ng::ristretto::RistrettoPoint;
/// extern crate rand_core;
/// use rand_core::OsRng;
///
Expand Down Expand Up @@ -672,8 +672,8 @@ impl RistrettoPoint {
/// # Example
///
/// ```
/// # extern crate curve25519_dalek;
/// # use curve25519_dalek::ristretto::RistrettoPoint;
/// # extern crate curve25519_dalek_ng;
/// # use curve25519_dalek_ng::ristretto::RistrettoPoint;
/// extern crate sha2;
/// use sha2::Sha512;
///
Expand Down Expand Up @@ -982,8 +982,8 @@ impl RistrettoPoint {
/// A precomputed table of multiples of the Ristretto basepoint is
/// available in the `constants` module:
/// ```
/// use curve25519_dalek::constants;
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::constants;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// let a = Scalar::from(87329482u64);
/// let P = &a * &constants::RISTRETTO_BASEPOINT_TABLE;
Expand Down Expand Up @@ -1030,14 +1030,14 @@ impl ConditionallySelectable for RistrettoPoint {
///
/// ```
/// # extern crate subtle;
/// # extern crate curve25519_dalek;
/// # extern crate curve25519_dalek_ng;
/// #
/// use subtle::ConditionallySelectable;
/// use subtle::Choice;
/// #
/// # use curve25519_dalek::traits::Identity;
/// # use curve25519_dalek::ristretto::RistrettoPoint;
/// # use curve25519_dalek::constants;
/// # use curve25519_dalek_ng::traits::Identity;
/// # use curve25519_dalek_ng::ristretto::RistrettoPoint;
/// # use curve25519_dalek_ng::constants;
/// # fn main() {
///
/// let A = RistrettoPoint::identity();
Expand Down
40 changes: 20 additions & 20 deletions src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//! `Some(Scalar)` in return:
//!
//! ```
//! use curve25519_dalek::scalar::Scalar;
//! use curve25519_dalek_ng::scalar::Scalar;
//!
//! let one_as_bytes: [u8; 32] = Scalar::one().to_bytes();
//! let a: Option<Scalar> = Scalar::from_canonical_bytes(one_as_bytes);
Expand All @@ -45,7 +45,7 @@
//! (in this case, \\( \ell + 2 \\)), we'll get `None` back:
//!
//! ```
//! use curve25519_dalek::scalar::Scalar;
//! use curve25519_dalek_ng::scalar::Scalar;
//!
//! let l_plus_two_bytes: [u8; 32] = [
//! 0xef, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
Expand All @@ -65,7 +65,7 @@
//! resultant scalar \\( \mod \ell \\), producing \\( 2 \\):
//!
//! ```
//! use curve25519_dalek::scalar::Scalar;
//! use curve25519_dalek_ng::scalar::Scalar;
//!
//! let l_plus_two_bytes: [u8; 32] = [
//! 0xef, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
Expand All @@ -90,12 +90,12 @@
//! which allows an IUF API.
//!
//! ```
//! # extern crate curve25519_dalek;
//! # extern crate curve25519_dalek_ng;
//! # extern crate sha2;
//! #
//! # fn main() {
//! use sha2::{Digest, Sha512};
//! use curve25519_dalek::scalar::Scalar;
//! use curve25519_dalek_ng::scalar::Scalar;
//!
//! // Hashing a single byte slice
//! let a = Scalar::hash_from_bytes::<Sha512>(b"Abolish ICE");
Expand All @@ -118,7 +118,7 @@
//! assurances as to reduction modulo the group order:
//!
//! ```
//! use curve25519_dalek::scalar::Scalar;
//! use curve25519_dalek_ng::scalar::Scalar;
//!
//! let l_plus_two_bytes: [u8; 32] = [
//! 0xef, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
Expand Down Expand Up @@ -499,7 +499,7 @@ impl From<u64> for Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// let fourtytwo = Scalar::from(42u64);
/// let six = Scalar::from(6u64);
Expand Down Expand Up @@ -545,10 +545,10 @@ impl Scalar {
///
/// ```
/// extern crate rand_core;
/// # extern crate curve25519_dalek;
/// # extern crate curve25519_dalek_ng;
/// #
/// # fn main() {
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// use rand_core::OsRng;
///
Expand All @@ -571,8 +571,8 @@ impl Scalar {
/// # Example
///
/// ```
/// # extern crate curve25519_dalek;
/// # use curve25519_dalek::scalar::Scalar;
/// # extern crate curve25519_dalek_ng;
/// # use curve25519_dalek_ng::scalar::Scalar;
/// extern crate sha2;
///
/// use sha2::Sha512;
Expand Down Expand Up @@ -601,8 +601,8 @@ impl Scalar {
/// # Example
///
/// ```
/// # extern crate curve25519_dalek;
/// # use curve25519_dalek::scalar::Scalar;
/// # extern crate curve25519_dalek_ng;
/// # use curve25519_dalek_ng::scalar::Scalar;
/// extern crate sha2;
///
/// use sha2::Digest;
Expand Down Expand Up @@ -639,7 +639,7 @@ impl Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// let s: Scalar = Scalar::zero();
///
Expand All @@ -654,7 +654,7 @@ impl Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// let s: Scalar = Scalar::zero();
///
Expand Down Expand Up @@ -694,7 +694,7 @@ impl Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// // x = 2238329342913194256032495932344128051776374960164957527413114840482143558222
/// let X: Scalar = Scalar::from_bytes_mod_order([
Expand Down Expand Up @@ -738,8 +738,8 @@ impl Scalar {
/// # Example
///
/// ```
/// # extern crate curve25519_dalek;
/// # use curve25519_dalek::scalar::Scalar;
/// # extern crate curve25519_dalek_ng;
/// # use curve25519_dalek_ng::scalar::Scalar;
/// # fn main() {
/// let mut scalars = [
/// Scalar::from(3u64),
Expand Down Expand Up @@ -1098,9 +1098,9 @@ impl Scalar {
/// This is intended for uses like input validation, where variable-time code is acceptable.
///
/// ```
/// # extern crate curve25519_dalek;
/// # extern crate curve25519_dalek_ng;
/// # extern crate subtle;
/// # use curve25519_dalek::scalar::Scalar;
/// # use curve25519_dalek_ng::scalar::Scalar;
/// # use subtle::ConditionallySelectable;
/// # fn main() {
/// // 2^255 - 1, since `from_bits` clears the high bit
Expand Down
24 changes: 12 additions & 12 deletions src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ pub trait MultiscalarMul {
/// iterators returning either `Scalar`s or `&Scalar`s.
///
/// ```
/// use curve25519_dalek::constants;
/// use curve25519_dalek::traits::MultiscalarMul;
/// use curve25519_dalek::ristretto::RistrettoPoint;
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::constants;
/// use curve25519_dalek_ng::traits::MultiscalarMul;
/// use curve25519_dalek_ng::ristretto::RistrettoPoint;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// // Some scalars
/// let a = Scalar::from(87329482u64);
Expand Down Expand Up @@ -120,10 +120,10 @@ pub trait VartimeMultiscalarMul {
/// inlining point decompression into the multiscalar call,
/// avoiding the need for temporary buffers.
/// ```
/// use curve25519_dalek::constants;
/// use curve25519_dalek::traits::VartimeMultiscalarMul;
/// use curve25519_dalek::ristretto::RistrettoPoint;
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::constants;
/// use curve25519_dalek_ng::traits::VartimeMultiscalarMul;
/// use curve25519_dalek_ng::ristretto::RistrettoPoint;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// // Some scalars
/// let a = Scalar::from(87329482u64);
Expand Down Expand Up @@ -183,10 +183,10 @@ pub trait VartimeMultiscalarMul {
/// iterators returning either `Scalar`s or `&Scalar`s.
///
/// ```
/// use curve25519_dalek::constants;
/// use curve25519_dalek::traits::VartimeMultiscalarMul;
/// use curve25519_dalek::ristretto::RistrettoPoint;
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ng::constants;
/// use curve25519_dalek_ng::traits::VartimeMultiscalarMul;
/// use curve25519_dalek_ng::ristretto::RistrettoPoint;
/// use curve25519_dalek_ng::scalar::Scalar;
///
/// // Some scalars
/// let a = Scalar::from(87329482u64);
Expand Down

0 comments on commit 6ba15aa

Please sign in to comment.