summaryrefslogtreecommitdiffstats
path: root/vendor/hkdf/benches/mod.rs
blob: 4679b59b72172773bb9b21c8d8b1c0be35ae9b8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#![feature(test)]
extern crate test;

use test::Bencher;

type HkdfSha256 = hkdf::Hkdf<sha2::Sha256>;

#[bench]
fn hkdf_sha256_10(b: &mut Bencher) {
    let mut okm = vec![0u8; 10];
    b.iter(|| HkdfSha256::new(Some(&[]), &[]).expand(&[], &mut okm));
    b.bytes = okm.len() as u64;
}

#[bench]
fn hkdf_sha256_1024(b: &mut Bencher) {
    let mut okm = vec![0u8; 1024];
    b.iter(|| HkdfSha256::new(Some(&[]), &[]).expand(&[], &mut okm));
    b.bytes = okm.len() as u64;
}

#[bench]
fn hkdf_sha256_8000(b: &mut Bencher) {
    let mut okm = vec![0u8; 8000];
    b.iter(|| HkdfSha256::new(Some(&[]), &[]).expand(&[], &mut okm));
    b.bytes = okm.len() as u64;
}