#![feature(test)] extern crate inane_crypto; extern crate test; use inane_crypto::block::{KeySchedule}; use inane_crypto::digest::{Digest}; use inane_crypto::password::{derive}; use inane_crypto::u256::{u256}; use test::{Bencher, black_box}; const DATA: &'static [u8] = include_bytes!("data"); #[bench] fn block_cipher(bencher: &mut Bencher) { bencher.iter(|| black_box(KeySchedule::new(u256(0, 0)).encrypt(u256(0, 0)))) } #[bench] fn digest_32kib(bencher: &mut Bencher) { bencher.bytes = DATA.len() as u64; bencher.iter(|| { let mut digest = Digest::new(); digest.update(DATA); black_box(digest.finish()) }); } #[bench] fn derive_1mib(bencher: &mut Bencher) { bencher.iter(|| black_box(derive(b"0123456789abcdef", b"0123456789abcdef", 4, 1 * 1024 * 1024 / 32, 1))); }