Pull in fork of sha2 that exposes compress256 round function
This commit is contained in:
parent
ecbd1bf825
commit
bba58807bb
|
|
@ -197,7 +197,7 @@ version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae"
|
checksum = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sha2",
|
"sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -390,7 +390,7 @@ dependencies = [
|
||||||
"curve25519-dalek",
|
"curve25519-dalek",
|
||||||
"rand_core 0.5.1",
|
"rand_core 0.5.1",
|
||||||
"serde",
|
"serde",
|
||||||
"sha2",
|
"sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -1511,6 +1511,17 @@ dependencies = [
|
||||||
"yaml-rust",
|
"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]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
|
|
@ -2070,7 +2081,7 @@ dependencies = [
|
||||||
"ripemd160",
|
"ripemd160",
|
||||||
"secp256k1",
|
"secp256k1",
|
||||||
"serde",
|
"serde",
|
||||||
"sha2",
|
"sha2 0.8.1 (git+https://github.com/ZcashFoundation/hashes?branch=expose-utils)",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"x25519-dalek",
|
"x25519-dalek",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,13 @@ lazy_static = "1.4.0"
|
||||||
ripemd160 = "0.8.0"
|
ripemd160 = "0.8.0"
|
||||||
secp256k1 = { version = "0.17.2", features = ["serde"] }
|
secp256k1 = { version = "0.17.2", features = ["serde"] }
|
||||||
serde = { version = "1", features = ["serde_derive"] }
|
serde = { version = "1", features = ["serde_derive"] }
|
||||||
sha2 = "0.8"
|
# sha2 = "0.8"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
x25519-dalek = "0.6"
|
x25519-dalek = "0.6"
|
||||||
# ZF deps
|
# ZF deps
|
||||||
redjubjub = "0.1"
|
|
||||||
ed25519-zebra = "0.2"
|
ed25519-zebra = "0.2"
|
||||||
|
redjubjub = "0.1"
|
||||||
|
sha2 = {git="https://github.com/ZcashFoundation/hashes", branch = "expose-utils", features=["utils"]}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = "0.9"
|
proptest = "0.9"
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,25 @@ use proptest::{array, collection::vec, prelude::*};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use proptest_derive::Arbitrary;
|
use proptest_derive::Arbitrary;
|
||||||
|
|
||||||
|
use sha2::sha256_utils::compress256;
|
||||||
|
|
||||||
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
|
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.
|
/// 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_.
|
/// Derived from a _SpendingKey_.
|
||||||
pub type ReceivingKey = x25519_dalek::StaticSecret;
|
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_.
|
/// Derived from a _SpendingKey_.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
pub struct PayingKey(pub [u8; 32]);
|
pub struct PayingKey(pub [u8; 32]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue