Dustin-Ray / capyCRYPT

An experimental high-performance cryptosystem.
MIT License
11 stars 1 forks source link

feature: add more benches #13

Open Dustin-Ray opened 11 months ago

Dustin-Ray commented 11 months ago

support benches for additional pairs of curves and sponge security parameters

Dustin-Ray commented 11 months ago

This is a super easy item, just check out the existing benches and add the rest of the curves and security strengths. If you're new to rust, you'll get to see some really nifty syntax along the way!

Dustin-Ray commented 10 months ago
  1. Create new file for the bench in the benches directory. Name it according to the convention of the other files. For the curve e222 paired with a 224 bit sponge, the file is named benchmark_e222_224.rs. If you are pairing e382 with a 384 bit sponge, name it benchmark_e382_384.rs
  2. Next, edit Cargo.toml in the directory by adding this new block:
    [[bench]]
    name = "benchmark_e382_384"
    harness = false
  3. Finally, in your new file benchmark_e382_384.rs, simply copy over all of the code from one of the other benches and paste. Here are the items you will need to update:
  1. That's it! There is a lot of advanced rust syntax in the benches that are worth studying, such as the use of closures, iterators, and macros. The study of those topics is left as an exercise to the reader, but do reach out with any questions on the topic!

You can run the benches easily with:

cargo bench

This will run them all. Close everything on your machine except the terminal running this command to get the best results. It generates some extremely cool HTML reports with graphs and metrics that you can find in ./target/criterion/report/index.html of the library directory. Go check it out after you run! Bonus points to calculate how many mbps of throughput the library can handle.

Here are a list of benches that need to be created: For curve e222:

For curve e382:

For curve e448:

For curve e512:

Dustin-Ray commented 6 months ago

we only support one variant of the edwards curve now so other benches should be comparing various sponge security parameters to the ed 448 curve

Dustin-Ray commented 2 months ago

need to bench the KEM now