mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
fixed bug with chacha20 encryption of short messages
This commit is contained in:
parent
8fc3a1f9c9
commit
abc4f6c70b
2 changed files with 3 additions and 2 deletions
|
@ -111,7 +111,8 @@ void Chacha20Encrypt (Chacha20State& state, uint8_t * buf, size_t sz)
|
|||
buf[i] ^= state.block.data[state.offset + i];
|
||||
buf += s;
|
||||
sz -= s;
|
||||
state.offset = 0;
|
||||
state.offset += s;
|
||||
if (state.offset >= chacha::blocksize) state.offset = 0;
|
||||
}
|
||||
for (size_t i = 0; i < sz; i += chacha::blocksize)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue