insectbox 0.1.0

OpenSSH inspired in-memory key security.
Documentation
use criterion::{criterion_group, criterion_main, Criterion};

use insectbox::SecBox;

fn secbox_new() {
    let b = SecBox::new(heapless::Vec::<u8, 0xff8>::new());
    let mut b = b.unlock();
    b.fill_with(|| 0x5d);
    let _b = SecBox::secure(b);
}

fn secbox_construct() {
    let b = SecBox::construct(heapless::Vec::<u8, 0xff8>::new);
    let mut b = b.unlock();
    b.fill_with(|| 0x5d);
    let _b = SecBox::secure(b);
}

fn criterion_benchmark(c: &mut Criterion) {
    c.bench_function("SecBox::new", |b| b.iter(|| secbox_new()));
    c.bench_function("SecBox::construct", |b| b.iter(|| secbox_construct()));
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);