diff --git a/Cargo.toml b/Cargo.toml index e7000c8b4..8cb20021f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,4 +26,6 @@ asm = ["sha2-asm"] rayon = "1.0.0" sha2 = "0.7.0" sha2-asm = {version="0.3", optional=true} -digest = "0.7.2" +generic-array = { version = "0.9.0", default-features = false, features = ["serde"] } +serde = "1.0.27" +serde_derive = "1.0.27" diff --git a/src/lib.rs b/src/lib.rs index 8b2e50cb8..3ccb87efc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,9 @@ #![cfg_attr(feature = "unstable", feature(test))] pub mod log; pub mod historian; -extern crate digest; +extern crate generic_array; extern crate rayon; +extern crate serde; +#[macro_use] +extern crate serde_derive; extern crate sha2; diff --git a/src/log.rs b/src/log.rs index 96da52eeb..ce2028513 100644 --- a/src/log.rs +++ b/src/log.rs @@ -13,11 +13,11 @@ /// fastest processor. Duration should therefore be estimated by assuming that the hash /// was generated by the fastest processor at the time the entry was logged. -use digest::generic_array::GenericArray; -use digest::generic_array::typenum::U32; +use generic_array::GenericArray; +use generic_array::typenum::U32; pub type Sha256Hash = GenericArray; -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] pub struct Entry { pub num_hashes: u64, pub end_hash: Sha256Hash, @@ -29,7 +29,7 @@ pub struct Entry { /// be generated in 'num_hashes' hashes and verified in 'num_hashes' hashes. By logging /// a hash alongside the tick, each tick and be verified in parallel using the 'end_hash' /// of the preceding tick to seed its hashing. -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] pub enum Event { Tick, UserDataKey(Sha256Hash),