Skip to content

Commit 3c4fe80

Browse files
committed
f - use encrypt_single_block_in_place
1 parent edb7533 commit 3c4fe80

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lightning/src/ln/inbound_payment.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ impl ExpandedKey {
9090
/// Encrypts or decrypts the given `bytes`. Used for data included in an offer message's
9191
/// metadata (e.g., payment id).
9292
pub(crate) fn crypt_for_offer(&self, mut bytes: [u8; 32], nonce: Nonce) -> [u8; 32] {
93-
let chacha_block = ChaCha20::get_single_block(&self.offers_encryption_key, &nonce.0);
94-
for i in 0..bytes.len() {
95-
bytes[i] = chacha_block[i] ^ bytes[i];
96-
}
97-
93+
ChaCha20::encrypt_single_block_in_place(&self.offers_encryption_key, &nonce.0, &mut bytes);
9894
bytes
9995
}
10096
}

0 commit comments

Comments
 (0)