A whimsical STROBE based encryption protocol
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

More benches, little tidy-ups

+19 -7
+17 -6
benches/garbl_bench.rs
··· 13 13 } 14 14 15 15 fn wharrgarbl_benchmark(c: &mut Criterion) { 16 - use wharrgarbl::transport::AeadStrobe; 17 - use wharrgarbl_strobe::Sec128; 16 + use wharrgarbl::{Sec128, Sec256, transport::AeadStrobe}; 18 17 19 18 let key = Array([77u8; 32]); 20 19 let nonce = Array([12u8; 16]); 21 20 22 - let transport = AeadStrobe::<Sec128>::new(&key); 21 + let transport_128 = AeadStrobe::<Sec128>::new(&key); 22 + let transport_256 = AeadStrobe::<Sec256>::new(&key); 23 + 24 + c.bench_function("WHGL-128 TRANSPORT ROUNDTRIP", |b| { 25 + b.iter_batched_ref( 26 + generate_text, 27 + |text| { 28 + let _ = transport_128.encrypt_in_place(&nonce, b"bench", black_box(text)); 29 + let _ = transport_128.decrypt_in_place(&nonce, b"bench", black_box(text)); 30 + }, 31 + criterion::BatchSize::LargeInput, 32 + ); 33 + }); 23 34 24 - c.bench_function("WHGL TRANSPORT ROUNDTRIP", |b| { 35 + c.bench_function("WHGL-256 TRANSPORT ROUNDTRIP", |b| { 25 36 b.iter_batched_ref( 26 37 generate_text, 27 38 |text| { 28 - let _ = transport.encrypt_in_place(&nonce, b"bench", black_box(text)); 29 - let _ = transport.decrypt_in_place(&nonce, b"bench", black_box(text)); 39 + let _ = transport_256.encrypt_in_place(&nonce, b"bench", black_box(text)); 40 + let _ = transport_256.decrypt_in_place(&nonce, b"bench", black_box(text)); 30 41 }, 31 42 criterion::BatchSize::LargeInput, 32 43 );
+1
wharrgarbl-strobe/src/strobe.rs
··· 167 167 self.start = 0; 168 168 } 169 169 170 + #[inline] 170 171 fn increment_position(&mut self, increment: usize) { 171 172 self.position += increment; 172 173
+1 -1
wharrgarbl-strobe/src/traits.rs
··· 8 8 Self::to_u16().to_le_bytes() 9 9 } 10 10 fn rate() -> usize { 11 - KECCAK_BUFFER_SIZE - (Self::to_usize()) / 4 - 2 11 + KECCAK_BUFFER_SIZE - Self::to_usize() / 4 - 2 12 12 } 13 13 fn ratchet_bytes() -> usize { 14 14 Self::to_usize() >> 3