Pull in fork of sha2 that exposes compress256 round function

This commit is contained in:
Deirdre Connolly 2020-03-18 20:26:07 -04:00 committed by Deirdre Connolly
parent ecbd1bf825
commit bba58807bb
3 changed files with 29 additions and 6 deletions

17
Cargo.lock generated
View File

@ -197,7 +197,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae"
dependencies = [
"sha2",
"sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -390,7 +390,7 @@ dependencies = [
"curve25519-dalek",
"rand_core 0.5.1",
"serde",
"sha2",
"sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror",
]
@ -1511,6 +1511,17 @@ dependencies = [
"yaml-rust",
]
[[package]]
name = "sha2"
version = "0.8.1"
source = "git+https://github.com/ZcashFoundation/hashes?branch=expose-utils#a968a8db2bffae75fbb31596897be9088ddbb821"
dependencies = [
"block-buffer",
"digest",
"fake-simd",
"opaque-debug",
]
[[package]]
name = "sha2"
version = "0.8.1"
@ -2070,7 +2081,7 @@ dependencies = [
"ripemd160",
"secp256k1",
"serde",
"sha2",
"sha2 0.8.1 (git+https://github.com/ZcashFoundation/hashes?branch=expose-utils)",
"thiserror",
"x25519-dalek",
]

View File

@ -17,12 +17,13 @@ lazy_static = "1.4.0"
ripemd160 = "0.8.0"
secp256k1 = { version = "0.17.2", features = ["serde"] }
serde = { version = "1", features = ["serde_derive"] }
sha2 = "0.8"
# sha2 = "0.8"
thiserror = "1"
x25519-dalek = "0.6"
# ZF deps
redjubjub = "0.1"
ed25519-zebra = "0.2"
redjubjub = "0.1"
sha2 = {git="https://github.com/ZcashFoundation/hashes", branch = "expose-utils", features=["utils"]}
[dev-dependencies]
proptest = "0.9"

View File

@ -16,14 +16,25 @@ use proptest::{array, collection::vec, prelude::*};
#[cfg(test)]
use proptest_derive::Arbitrary;
use sha2::sha256_utils::compress256;
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
/// Our root secret key of the Sprout key derivation tree.
///
/// All other Sprout key types derive from the SpendingKey value.
pub struct SpendingKey;
/// Actually 252 bits.
pub struct SpendingKey(pub [u8; 32]);
/// Derived from a _SpendingKey_.
pub type ReceivingKey = x25519_dalek::StaticSecret;
impl From<SpendingKey> for ReceivingKey {
fn from(spending_key: SpendingKey) -> ReceivingKey {
ReceivingKey::from(spending_key.0)
}
}
/// Derived from a _SpendingKey_.
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PayingKey(pub [u8; 32]);