pub fn encrypt_note_plaintext(&self) -> [u8; ENC_CIPHERTEXT_SIZE] {
        let shared_secret = sapling_ka_agree(&self.esk, self.to.pk_d().into());
        let key = kdf_sapling(shared_secret, &self.epk.into());

        // Note plaintext encoding is defined in section 5.5 of the Zcash Protocol
        // Specification.
        let mut input = [0; NOTE_PLAINTEXT_SIZE];
        input[0] = match self.note.rseed {
            Rseed::BeforeZip212(_) => 1,
            Rseed::AfterZip212(_) => 2,
        };
        input[1..12].copy_from_slice(&self.to.diversifier().0);
        (&mut input[12..20])
            .write_u64::<LittleEndian>(self.note.value)
            .unwrap();
        match self.note.rseed {
            Rseed::BeforeZip212(rcm) => {
                input[20..COMPACT_NOTE_SIZE].copy_from_slice(rcm.to_repr().as_ref());
            }
            Rseed::AfterZip212(rseed) => {
                input[20..COMPACT_NOTE_SIZE].copy_from_slice(&rseed);
            }
        }
        input[COMPACT_NOTE_SIZE..NOTE_PLAINTEXT_SIZE].copy_from_slice(self.memo.as_array());

        let mut output = [0u8; ENC_CIPHERTEXT_SIZE];
        assert_eq!(
            ChachaPolyIetf::aead_cipher()
                .seal_to(&mut output, &input, &[], &key.as_bytes(), &[0u8; 12])
                .unwrap(),
            ENC_CIPHERTEXT_SIZE
        );

        output
    }
/// Generates `encCiphertext` for this note.
Generates `encCiphertext` for this note.
Generates ` encCiphertext ` for this note .
pub fn encrypt_note_plaintext(&self) -> [u8; ENC_CIPHERTEXT_SIZE] {
        let shared_secret = sapling_ka_agree(&self.esk, self.to.pk_d().into());
        let key = kdf_sapling(shared_secret, &self.epk.into());
        // Note plaintext encoding is defined in section 5.5 of the Zcash Protocol
        // Specification.
        let mut input = [0; NOTE_PLAINTEXT_SIZE];
        input[0] = match self.note.rseed {
            Rseed::BeforeZip212(_) => 1,
            Rseed::AfterZip212(_) => 2,
        };
        input[1..12].copy_from_slice(&self.to.diversifier().0);
        (&mut input[12..20])
            .write_u64::<LittleEndian>(self.note.value)
            .unwrap();
        match self.note.rseed {
            Rseed::BeforeZip212(rcm) => {
                input[20..COMPACT_NOTE_SIZE].copy_from_slice(rcm.to_repr().as_ref());
            }
            Rseed::AfterZip212(rseed) => {
                input[20..COMPACT_NOTE_SIZE].copy_from_slice(&rseed);
            }
        }
        input[COMPACT_NOTE_SIZE..NOTE_PLAINTEXT_SIZE].copy_from_slice(self.memo.as_array());
        let mut output = [0u8; ENC_CIPHERTEXT_SIZE];
        assert_eq!(
            ChachaPolyIetf::aead_cipher()
                .seal_to(&mut output, &input, &[], &key.as_bytes(), &[0u8; 12])
                .unwrap(),
            ENC_CIPHERTEXT_SIZE
        );
        output
    }
pub fn encrypt_note_plaintext ( & self ) -> [ u8 ; ENC_CIPHERTEXT_SIZE ] { let shared_secret = sapling_ka_agree ( & self . esk , self . to . pk_d ( ) . into ( ) ) ; let key = kdf_sapling ( shared_secret , & self . epk . into ( ) ) ; // Note plaintext encoding is defined in section 5.5 of the Zcash Protocol // Specification. let mut input = [ 0 ; NOTE_PLAINTEXT_SIZE ] ; input [ 0 ] = match self . note . rseed { Rseed :: BeforeZip212 ( _ ) => 1 , Rseed :: AfterZip212 ( _ ) => 2 , } ; input [ 1 .. 12 ] . copy_from_slice ( & self . to . diversifier ( ) . 0 ) ; ( & mut input [ 12 .. 20 ] ) . write_u64 :: < LittleEndian > ( self . note . value ) . unwrap ( ) ; match self . note . rseed { Rseed :: BeforeZip212 ( rcm ) => { input [ 20 .. COMPACT_NOTE_SIZE ] . copy_from_slice ( rcm . to_repr ( ) . as_ref ( ) ) ; } Rseed :: AfterZip212 ( rseed ) => { input [ 20 .. COMPACT_NOTE_SIZE ] . copy_from_slice ( & rseed ) ; } } input [ COMPACT_NOTE_SIZE .. NOTE_PLAINTEXT_SIZE ] . copy_from_slice ( self . memo . as_array ( ) ) ; let mut output = [ 0u8 ; ENC_CIPHERTEXT_SIZE ] ; assert_eq ! ( ChachaPolyIetf aead_cipher ( ) seal_to ( mut output input [ ] key as_bytes ( ) [ 0u8 12 ] ) unwrap ( ) ENC_CIPHERTEXT_SIZE ) ; output }
Generates `encCiphertext` for this note.
Generates ` encCiphertext ` for this note .
&self
&self