diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-06-03 01:16:08 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-06-03 01:16:08 -0400 |
commit | f68ff03d06a489114989b501e7e82cba1525f99e (patch) | |
tree | 473a994b9d15c3c32a8006e476755f2ffa38721b /src/crypto.rs | |
parent | a4d30ec5255a188ad9c359c52fd74d8091721e62 (diff) | |
download | ucp-f68ff03d06a489114989b501e7e82cba1525f99e.tar.gz ucp-f68ff03d06a489114989b501e7e82cba1525f99e.zip |
optimize by increasing CHUNK_SIZE to 16KB (from 4KB)
Diffstat (limited to 'src/crypto.rs')
-rw-r--r-- | src/crypto.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto.rs b/src/crypto.rs index d6b65be..da0a770 100644 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -9,13 +9,14 @@ use rustc_serialize::base64::{ToBase64, FromBase64, STANDARD}; use std::mem::transmute; // TODO: handle case of splitting up writes > 2^32 bytes into multiple small writes +const CHUNK_SIZE: usize = 1024*64; pub struct SecretStream<S: Read+Write> { pub read_nonce: Nonce, pub write_nonce: Nonce, pub key: Key, inner: S, - read_buf: [u8; 4096+1024], + read_buf: [u8; CHUNK_SIZE+512], read_buf_offset: usize, read_buf_len: usize, } @@ -27,7 +28,7 @@ impl<S: Read+Write> SecretStream<S> { read_nonce: secretbox::gen_nonce(), write_nonce: secretbox::gen_nonce(), key: secretbox::gen_key(), - read_buf: [0; 4096+1024], + read_buf: [0; CHUNK_SIZE+512], read_buf_offset: 0, read_buf_len: 0, } |