From 1bbeda87ebdb101aad881adf69e975c078d9a02a Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Wed, 16 Jan 2019 16:03:34 -0500 Subject: [PATCH] Remove fuzz_util module Not needed anymore as the bitcoin_hashes crate handles this. --- src/fuzz_util/mod.rs | 4 --- src/fuzz_util/sha2.rs | 63 ------------------------------------------- src/lib.rs | 3 --- 3 files changed, 70 deletions(-) delete mode 100644 src/fuzz_util/mod.rs delete mode 100644 src/fuzz_util/sha2.rs diff --git a/src/fuzz_util/mod.rs b/src/fuzz_util/mod.rs deleted file mode 100644 index bbf67d3d..00000000 --- a/src/fuzz_util/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -//! This module contains all mocks that are used for fuzz testing. Never use anything from this -//! module in production. - -pub mod sha2; \ No newline at end of file diff --git a/src/fuzz_util/sha2.rs b/src/fuzz_util/sha2.rs deleted file mode 100644 index 40b4e5b4..00000000 --- a/src/fuzz_util/sha2.rs +++ /dev/null @@ -1,63 +0,0 @@ -//! fuzztarget-only Sha2 context with a dummy Sha256 and Sha512 hashers. - -use crypto::digest::Digest; - -#[derive(Clone, Copy)] -/// Dummy Sha256 that hashes the input, but only returns the first byte of output, masking the -/// rest to 0s. -pub struct Sha256 { - state: u8, -} - -impl Sha256 { - /// Constructs a new dummy Sha256 context - pub fn new() -> Sha256 { - Sha256 { - state: 0, - } - } -} - -impl Digest for Sha256 { - fn result(&mut self, data: &mut [u8]) { - data[0] = self.state; - for i in 1..32 { - data[i] = 0; - } - } - - fn input(&mut self, data: &[u8]) { for i in data { self.state ^= i; } } - fn reset(&mut self) { self.state = 0; } - fn output_bits(&self) -> usize { 256 } - fn block_size(&self) -> usize { 64 } -} - -#[derive(Clone, Copy)] -/// Dummy Sha512 that hashes the input, but only returns the first byte of output, masking the -/// rest to 0s. -pub struct Sha512 { - state: u8, -} - -impl Sha512 { - /// Constructs a new dummy Sha512 context - pub fn new() -> Sha512 { - Sha512 { - state: 0xff, - } - } -} - -impl Digest for Sha512 { - fn result(&mut self, data: &mut [u8]) { - data[0] = self.state; - for i in 1..64 { - data[i] = 0; - } - } - - fn input(&mut self, data: &[u8]) { for i in data { self.state ^= i; } } - fn reset(&mut self) { self.state = 0xff; } - fn output_bits(&self) -> usize { 512 } - fn block_size(&self) -> usize { 128 } -} diff --git a/src/lib.rs b/src/lib.rs index 9f187492..199dc2f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,6 +80,3 @@ pub use util::hash::BitcoinHash; pub use util::privkey::Privkey; pub use util::decimal::Decimal; pub use util::decimal::UDecimal; - -#[cfg(feature = "fuzztarget")] -pub mod fuzz_util;