From a34b2f621b95ad103dc0d9dcfe251ce2b42ebed5 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Wed, 3 Feb 2021 21:44:54 -0600 Subject: [PATCH] Improve documentation slightly --- Cargo.toml | 7 +++++-- src/lib.rs | 6 ++++++ src/traits.rs | 28 ++++++++++++++-------------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9ddfb23..a5cee12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "brute-force" -version = "0.1.0" +version = "0.1.1" authors = ["Lee Bousfield "] edition = "2018" license = "MIT" description = "A library for brute forcing arbitrary computations" -respository = "https://github.com/PlasmaPower/brute-force" +repository = "https://github.com/PlasmaPower/brute-force" documentation = "https://docs.rs/brute-force" [dependencies] @@ -23,3 +23,6 @@ curve25519 = ["curve25519-dalek", "rand"] [dev-dependencies] blake2 = "0.9.1" hex = "0.4.2" + +[package.metadata.docs.rs] +rustc-args = ["--features", "curve25519"] diff --git a/src/lib.rs b/src/lib.rs index 3d206ec..081615c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,9 @@ +//! A library for brute forcing arbitrary computations. +//! Check out the main entrypoint, [brute_force], or the various [adaptors] you +//! can use to write simpler checking functions. +//! For complete examples, look at +//! [the tests directory](https://github.com/PlasmaPower/brute-force/tree/master/src/tests). + use log::warn; use std::{ sync::atomic::{self, AtomicBool}, diff --git a/src/traits.rs b/src/traits.rs index 2d01f34..f463b99 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -50,6 +50,20 @@ impl_for_primitive!(u32, i32); impl_for_primitive!(u64, i64); impl_for_primitive!(u128, i128); +#[cfg(feature = "curve25519-dalek")] +impl Start for curve25519_dalek::scalar::Scalar { + fn start_for_thread(_thread: usize, _thread_count: usize) -> Self { + Self::random(&mut rand::rngs::OsRng) + } +} + +#[cfg(feature = "curve25519-dalek")] +impl Advance for curve25519_dalek::scalar::Scalar { + fn advance(&mut self) { + *self += curve25519_dalek::scalar::Scalar::one(); + } +} + macro_rules! impl_for_bytes { ($n:tt, $($t:tt)*) => { impl<$($t)*> Start for [u8; $n] { @@ -122,17 +136,3 @@ mod impl_bytes { impl_for_bytes!(128,); impl_for_bytes!(256,); } - -#[cfg(feature = "curve25519-dalek")] -impl Start for curve25519_dalek::scalar::Scalar { - fn start_for_thread(_thread: usize, _thread_count: usize) -> Self { - Self::random(&mut rand::rngs::OsRng) - } -} - -#[cfg(feature = "curve25519-dalek")] -impl Advance for curve25519_dalek::scalar::Scalar { - fn advance(&mut self) { - *self += curve25519_dalek::scalar::Scalar::one(); - } -}