-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into franziskus/drop-tests-from-package
- Loading branch information
Showing
17 changed files
with
19,819 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; | ||
use hpke_rs_crypto::{types::KemAlgorithm, HpkeCrypto}; | ||
use hpke_rs_rust_crypto::*; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
c.bench_function(&format!("K256 Derive"), |b| { | ||
b.iter_batched( | ||
|| { | ||
let sk = HpkeRustCrypto::kem_key_gen( | ||
KemAlgorithm::DhKemK256, | ||
&mut HpkeRustCrypto::prng(), | ||
) | ||
.unwrap(); | ||
let pk = HpkeRustCrypto::kem_derive_base(KemAlgorithm::DhKemK256, &sk).unwrap(); | ||
(sk.clone(), pk.clone()) | ||
}, | ||
|(sk, pk)| { | ||
let _ = HpkeRustCrypto::kem_derive(KemAlgorithm::DhKemK256, &pk, &sk); | ||
}, | ||
BatchSize::SmallInput, | ||
) | ||
}); | ||
c.bench_function(&format!("K256 Derive Base"), |b| { | ||
b.iter_batched( | ||
|| { | ||
let sk = HpkeRustCrypto::kem_key_gen( | ||
KemAlgorithm::DhKemK256, | ||
&mut HpkeRustCrypto::prng(), | ||
) | ||
.unwrap(); | ||
sk.clone() | ||
}, | ||
|sk| { | ||
let _pk = HpkeRustCrypto::kem_derive_base(KemAlgorithm::DhKemK256, &sk).unwrap(); | ||
}, | ||
BatchSize::SmallInput, | ||
) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark,); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.