strobe-rs

Build Status Version Docs

This is a relatively barebones implementation of the Strobe protocol framework in pure Rust. It is intended to be used as a library to build other protocols and frameworks. This implementation currently only supports Keccak-f[1600] as the internal permutation function, which is the largest possible block size, so big deal.

Example

A simple program that encrypts and decrypts a message:

```rust use strobe_rs::{SecParam, Strobe};

fn main() { let mut rx = Strobe::new(b"correctnesstest", SecParam::B256); let mut tx = Strobe::new(b"correctnesstest", SecParam::B256);

rx.key(b"the-combination-on-my-luggage", false);
tx.key(b"the-combination-on-my-luggage", false);

let mut msg = b"Attack at dawn".to_vec();
rx.send_enc(msg.as_mut_slice(), false);

// Rename for clarity. `msg` has been encrypted in-place.
let mut ciphertext = msg;

tx.recv_enc(ciphertext.as_mut_slice(), false);

// And back again.
let round_trip_msg = ciphertext;

assert_eq!(&round_trip_msg, b"Attack at dawn");

} ```

Features

For info on how to omit or include feature flags, see the cargo docs on features.

Tests

To run tests, execute cargo test. This includes known-answer tests, which test against JSON-encoded test vectors in the kat/ directory. To verify these test vectors against the reference Python implementation, cd into kat/, run python2 kat/verify_test_vector.py and follow the included instructions.

Benchmarks

Since benchmarks are still not stable, run cargo +nightly bench.

TODO

License

Licensed under either of

at your option.

Warning

This code has not been audited in any sense of the word. Use at your own discretion.