[Rust] Add examples
LuoZijun opened this issue · comments
寧靜 commented
This is a great project. Thank you @tarcieri .
For those who don't know much about cryptography,
it would be very useful if there were some very common usage examples.
I suggest writing two usage examples:
- encrypt/decrypt(&message)
- encrypt/decrypt(&partial_message)
// Case 1
let message: Vec<u8> = vec![ ... ];
aes_siv.encrypt(&message);
// Case 2
let file = File::open("/bigfile.txt");
let mut filesize = file.size();
while filesize > 0 {
aes_siv.encrypt(&file.read(1024));
filesize -= 1024;
}
K.J. Valencik commented
If you are interested, I'm using it in a small CLI. It shows how to stream without knowing the message size.
寧靜 commented
@kjvalencik Thanks.