diff options
author | lloyd <[email protected]> | 2013-08-14 21:05:14 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-08-14 21:05:14 +0000 |
commit | 02e0329fd2d127b6602188f698f5b6fd2879f8e3 (patch) | |
tree | be2ea4cbe451208eb54b74ec6b7431d4d2c9c14c | |
parent | ebff120efca0310761df8c8b0de9e8d821ca11cb (diff) |
XOR all input at once in CBC decrypt, much much faster
-rw-r--r-- | src/filters/modes/cbc/cbc.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/filters/modes/cbc/cbc.cpp b/src/filters/modes/cbc/cbc.cpp index 00518fc86..efb788663 100644 --- a/src/filters/modes/cbc/cbc.cpp +++ b/src/filters/modes/cbc/cbc.cpp @@ -172,10 +172,7 @@ void CBC_Decryption::buffered_block(const byte input[], size_t length) xor_buf(&temp[0], &state[0], cipher->block_size()); - for(size_t i = 1; i < to_proc; ++i) - xor_buf(&temp[i * cipher->block_size()], - input + (i-1) * cipher->block_size(), - cipher->block_size()); + xor_buf(&temp[cipher->block_size()], input, (to_proc-1) * cipher->block_size()); copy_mem(&state[0], input + (to_proc - 1) * cipher->block_size(), |