Skip to content

Commit 3cbc125

Browse files
rokadamreeve
andcommitted
Apply suggestions from code review
Co-authored-by: Adam Reeve <[email protected]>
1 parent 6d3b81f commit 3cbc125

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

parquet/src/encryption/encrypt.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ pub(crate) fn encrypt_object<T: TSerializable, W: Write>(
395395
Ok(())
396396
}
397397

398-
pub(crate) fn sign_and_write_object<T: TSerializable, W: Write>(
398+
pub(crate) fn write_signed_plaintext_object<T: TSerializable, W: Write>(
399399
object: &T,
400400
encryptor: &mut Box<dyn BlockEncryptor>,
401401
sink: &mut W,
@@ -413,11 +413,11 @@ pub(crate) fn sign_and_write_object<T: TSerializable, W: Write>(
413413
.try_into()
414414
.map_err(|err| general_err!("Plaintext data too long. {:?}", err))?;
415415

416-
// Format is: [ciphertext size, nonce, ciphertext, authentication tag]
417-
let nonce = buffer[SIZE_LEN..SIZE_LEN + NONCE_LEN].to_vec();
418-
let tag = buffer[(ciphertext_length - TAG_LEN as u32) as usize..].to_vec();
419-
sink.write_all(&nonce)?;
420-
sink.write_all(&tag)?;
416+
// Format of encrypted buffer is: [ciphertext size, nonce, ciphertext, authentication tag]
417+
let nonce = &buffer[SIZE_LEN..SIZE_LEN + NONCE_LEN];
418+
let tag = &buffer[(buffer.len() - TAG_LEN)..];
419+
sink.write_all(nonce)?;
420+
sink.write_all(tag)?;
421421

422422
Ok(())
423423
}

0 commit comments

Comments
 (0)