From 1a0131928e54fce0623afe1bea5799277b40be6a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 12 Dec 2017 11:41:36 -0800 Subject: start flushing out new APIs --- src/protocol.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/protocol.rs') diff --git a/src/protocol.rs b/src/protocol.rs index 2b23959..5940840 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -60,6 +60,7 @@ fn msg_sugar(msg: &DatNetMessage) -> &Message { /// This helper is pretty slow/inefficient; lots of copying memory fn bytewise_stream_xor_ic_inplace(buf: &mut [u8], byte_offset: u64, nonce: &Nonce, key: &Key) { + // TODO: switch to new stream_xor_ic_inplace() variant? let mut offset = byte_offset; // We may have a partial-64-byte-block to finish encrypting first @@ -70,14 +71,14 @@ fn bytewise_stream_xor_ic_inplace(buf: &mut [u8], byte_offset: u64, nonce: &Nonc for i in 0..partial_len { partial[partial_offset + i] = buf[i]; } - let partial_enc = stream_xor_ic(&partial, offset / 64, &nonce, &key); + let partial_enc = stream_xor_ic(&partial, &nonce, offset / 64, &key); offset += partial_len as u64; for i in 0..partial_len { buf[i] = partial_enc[partial_offset + i]; } } if buf.len() > partial_len { - let main_enc = stream_xor_ic(&buf[partial_len..], offset / 64, &nonce, &key); + let main_enc = stream_xor_ic(&buf[partial_len..], &nonce, offset / 64, &key); //offset += main_enc.len() as u64; for i in 0..main_enc.len() { buf[partial_len + i] = main_enc[i]; -- cgit v1.2.3