miscreant / meta

Meta-repository for Miscreant: misuse-resistant symmetric encryption library with AES-SIV (RFC 5297) and AES-PMAC-SIV support
https://miscreant.io
Other
474 stars 27 forks source link

[Rust] Add examples #169

Closed LuoZijun closed 5 years ago

LuoZijun commented 6 years ago

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:

// 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;
}
kjvalencik commented 5 years ago

If you are interested, I'm using it in a small CLI. It shows how to stream without knowing the message size.

https://github.com/kjvalencik/ghshare

LuoZijun commented 5 years ago

@kjvalencik Thanks.