Merge rust-bitcoin/rust-bitcoin#4105: Automated nightly rustfmt (2025-02-23)

0596867048 2025-02-23 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 0596867048be131f3af26f5f8be4b36f1fe186b0; successfully ran local tests

Tree-SHA512: 84a3b7c79939c1bcd0c3e30b117e0f681923a8c0825ee8852845abc0ec0677f3a6033c6133eba7742b9bb4e67d635614be5cd2d983d07c5866396142a8d8c3bc
This commit is contained in:
merge-script 2025-02-24 17:31:28 +00:00
commit 5a0d5d7b79
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 27 additions and 30 deletions

View File

@ -4,42 +4,39 @@ use crate::{ChaCha20, Key, Nonce};
#[bench] #[bench]
pub fn chacha20_10(bh: &mut Bencher) { pub fn chacha20_10(bh: &mut Bencher) {
let key = let key = Key::new([0u8; 32]);
Key::new([0u8; 32]); let nonce = Nonce::new([0u8; 12]);
let nonce = Nonce::new([0u8; 12]); let count = 1;
let count = 1; let mut chacha = ChaCha20::new(key, nonce, count);
let mut chacha = ChaCha20::new(key, nonce, count); let mut bytes = [0u8; 10];
let mut bytes = [0u8; 10]; bh.iter(|| {
bh.iter(|| { chacha.apply_keystream(&mut bytes[..]);
chacha.apply_keystream(&mut bytes[..]); });
}); bh.bytes = bytes.len() as u64;
bh.bytes = bytes.len() as u64;
} }
#[bench] #[bench]
pub fn chacha20_1k(bh: &mut Bencher) { pub fn chacha20_1k(bh: &mut Bencher) {
let key = let key = Key::new([0u8; 32]);
Key::new([0u8; 32]); let nonce = Nonce::new([0u8; 12]);
let nonce = Nonce::new([0u8; 12]); let count = 1;
let count = 1; let mut chacha = ChaCha20::new(key, nonce, count);
let mut chacha = ChaCha20::new(key, nonce, count); let mut bytes = [0u8; 1024];
let mut bytes = [0u8; 1024]; bh.iter(|| {
bh.iter(|| { chacha.apply_keystream(&mut bytes[..]);
chacha.apply_keystream(&mut bytes[..]); });
}); bh.bytes = bytes.len() as u64;
bh.bytes = bytes.len() as u64;
} }
#[bench] #[bench]
pub fn chacha20_64k(bh: &mut Bencher) { pub fn chacha20_64k(bh: &mut Bencher) {
let key = let key = Key::new([0u8; 32]);
Key::new([0u8; 32]); let nonce = Nonce::new([0u8; 12]);
let nonce = Nonce::new([0u8; 12]); let count = 1;
let count = 1; let mut chacha = ChaCha20::new(key, nonce, count);
let mut chacha = ChaCha20::new(key, nonce, count); let mut bytes = [0u8; 65536];
let mut bytes = [0u8; 65536]; bh.iter(|| {
bh.iter(|| { chacha.apply_keystream(&mut bytes[..]);
chacha.apply_keystream(&mut bytes[..]); });
}); bh.bytes = bytes.len() as u64;
bh.bytes = bytes.len() as u64;
} }