From f68ff03d06a489114989b501e7e82cba1525f99e Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 3 Jun 2016 01:16:08 -0400 Subject: optimize by increasing CHUNK_SIZE to 16KB (from 4KB) --- src/crypto.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/crypto.rs') 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 { 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 SecretStream { 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, } -- cgit v1.2.3