orchard: impl From<SpendingKey> for NullifierDerivingKey

This commit is contained in:
Deirdre Connolly 2021-03-08 15:44:25 -05:00 committed by Deirdre Connolly
parent f50d8697d4
commit 6e1d2f1fb1
1 changed files with 2 additions and 7 deletions

View File

@ -355,16 +355,11 @@ impl From<&NullifierDerivingKey> for [u8; 32] {
}
impl From<SpendingKey> for NullifierDerivingKey {
/// Requires JubJub's _FindGroupHash^J("Zcash_H_", "")_, then uses
/// the resulting generator point to scalar multiply the
/// ProofAuthorizingKey into the new NullifierDerivingKey
/// nk = ToBase^Orchard(PRF^expand_sk ([7]))
///
/// https://zips.z.cash/protocol/protocol.pdf#orchardkeycomponents
/// https://zips.z.cash/protocol/protocol.pdf#concretegrouphashjubjub
fn from(sk: SpendingKey) -> Self {
let generator_point = prf_expand(sk, []);
Self(pallas::Affine::from(generator_point * sk.0))
Self(pallas::Base::from_bytes_wide(prf_expand(sk, [7])))
}
}