Add comments with specification references

This commit is contained in:
Jack Grigg 2019-06-05 14:19:33 +01:00
parent 6d03b5c1db
commit 23aa869bf4
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
2 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,6 @@
//! Sapling key components
//! Sapling key components.
//!
//! Implements section 4.2.2 of the Zcash Protocol Specification.
use blake2_rfc::blake2b::{Blake2b, Blake2bResult};
use ff::{PrimeField, PrimeFieldRepr};

View File

@ -297,6 +297,8 @@ impl SaplingNoteEncryption {
let shared_secret = sapling_ka_agree(&self.esk, &self.to.pk_d);
let key = kdf_sapling(&shared_secret, &self.epk);
// Note plaintext encoding is defined in section 5.5 of the Zcash Protocol
// Specification.
let mut input = Vec::with_capacity(NOTE_PLAINTEXT_SIZE);
input.push(1);
input.extend_from_slice(&self.to.diversifier.0);