pub fn encrypt_outgoing_plaintext(
        &mut self,
        cv: &jubjub::ExtendedPoint,
        cmu: &bls12_381::Scalar,
    ) -> [u8; OUT_CIPHERTEXT_SIZE] {
        let (ock, input) = if let Some(ovk) = &self.ovk {
            let ock = prf_ock(ovk, &cv, &cmu, &self.epk.into());

            let mut input = [0u8; OUT_PLAINTEXT_SIZE];
            input[0..32].copy_from_slice(&self.note.pk_d.to_bytes());
            input[32..OUT_PLAINTEXT_SIZE].copy_from_slice(self.esk.to_repr().as_ref());

            (ock, input)
        } else {
            // ovk = ⊥
            let mut ock = OutgoingCipherKey([0; 32]);
            let mut input = [0u8; OUT_PLAINTEXT_SIZE];

            self.rng.fill_bytes(&mut ock.0);
            self.rng.fill_bytes(&mut input);

            (ock, input)
        };

        let mut output = [0u8; OUT_CIPHERTEXT_SIZE];
        assert_eq!(
            ChachaPolyIetf::aead_cipher()
                .seal_to(&mut output, &input, &[], ock.as_ref(), &[0u8; 12])
                .unwrap(),
            OUT_CIPHERTEXT_SIZE
        );

        output
    }
/// Generates `outCiphertext` for this note.
Generates `outCiphertext` for this note.
Generates ` outCiphertext ` for this note .
pub fn encrypt_outgoing_plaintext(
        &mut self,
        cv: &jubjub::ExtendedPoint,
        cmu: &bls12_381::Scalar,
    ) -> [u8; OUT_CIPHERTEXT_SIZE] {
        let (ock, input) = if let Some(ovk) = &self.ovk {
            let ock = prf_ock(ovk, &cv, &cmu, &self.epk.into());
            let mut input = [0u8; OUT_PLAINTEXT_SIZE];
            input[0..32].copy_from_slice(&self.note.pk_d.to_bytes());
            input[32..OUT_PLAINTEXT_SIZE].copy_from_slice(self.esk.to_repr().as_ref());
            (ock, input)
        } else {
            // ovk = ⊥
            let mut ock = OutgoingCipherKey([0; 32]);
            let mut input = [0u8; OUT_PLAINTEXT_SIZE];
            self.rng.fill_bytes(&mut ock.0);
            self.rng.fill_bytes(&mut input);
            (ock, input)
        };
        let mut output = [0u8; OUT_CIPHERTEXT_SIZE];
        assert_eq!(
            ChachaPolyIetf::aead_cipher()
                .seal_to(&mut output, &input, &[], ock.as_ref(), &[0u8; 12])
                .unwrap(),
            OUT_CIPHERTEXT_SIZE
        );
        output
    }
pub fn encrypt_outgoing_plaintext ( & mut self , cv : & jubjub :: ExtendedPoint , cmu : & bls12_381 :: Scalar , ) -> [ u8 ; OUT_CIPHERTEXT_SIZE ] { let ( ock , input ) = if let Some ( ovk ) = & self . ovk { let ock = prf_ock ( ovk , & cv , & cmu , & self . epk . into ( ) ) ; let mut input = [ 0u8 ; OUT_PLAINTEXT_SIZE ] ; input [ 0 .. 32 ] . copy_from_slice ( & self . note . pk_d . to_bytes ( ) ) ; input [ 32 .. OUT_PLAINTEXT_SIZE ] . copy_from_slice ( self . esk . to_repr ( ) . as_ref ( ) ) ; ( ock , input ) } else { // ovk = ⊥ let mut ock = OutgoingCipherKey ( [ 0 ; 32 ] ) ; let mut input = [ 0u8 ; OUT_PLAINTEXT_SIZE ] ; self . rng . fill_bytes ( & mut ock . 0 ) ; self . rng . fill_bytes ( & mut input ) ; ( ock , input ) } ; let mut output = [ 0u8 ; OUT_CIPHERTEXT_SIZE ] ; assert_eq ! ( ChachaPolyIetf aead_cipher ( ) seal_to ( mut output input [ ] ock as_ref ( ) [ 0u8 12 ] ) unwrap ( ) OUT_CIPHERTEXT_SIZE ) ; output }
Generates `outCiphertext` for this note.
Generates ` outCiphertext ` for this note .
&mut self
cv
&jubjub::ExtendedPoint
cmu
&bls12_381::Scalar
&mut self
cv
&jubjub::ExtendedPoint
cmu
&bls12_381::Scalar