Remove the ZeroDigest from the benchmark suite.

It turns out that testing scalar_mult_vartime() on all zeroes is fast.
This commit is contained in:
Isis Lovecruft 2017-03-15 18:53:48 +00:00
parent 5e84eedfbb
commit 394d1face2
Failed to extract signature
2 changed files with 1 additions and 23 deletions

View file

@ -36,6 +36,7 @@ version = "^0.6"
[dev-dependencies]
rustc-serialize = "0.3"
blake2 = "^0.4"
[features]
default = ["std"]

View file

@ -497,8 +497,6 @@ mod test {
mod bench {
use blake2::Blake2b;
use digest::Digest;
use generic_array::GenericArray;
use generic_array::typenum::{U64, U128};
use test::Bencher;
use rand::OsRng;
use super::*;
@ -522,27 +520,6 @@ mod bench {
}
}
/// A fake hash function which simply returns zeroes.
struct ZeroDigest;
impl ZeroDigest {
pub fn new() -> ZeroDigest {
ZeroDigest
}
}
impl Digest for ZeroDigest {
type OutputSize = U64;
type BlockSize = U128;
fn input(&mut self, _input: &[u8]) { }
fn result(self) -> GenericArray<u8, Self::OutputSize> { GenericArray::default() }
}
impl Default for ZeroDigest {
fn default() -> Self { Self::new() }
}
#[bench]
fn sign(b: &mut Bencher) {
let mut cspring: OsRng = OsRng::new().unwrap();