smashnet/Peergroup

Encryption is very slow

Closed this issue · 1 comments

I temporarily disabled chunk encryption because it drastically slowed down the data transfer. Some numbers:

Scenario: 3 peers, one has new 100mb file
Distribution with AES128 encryption: ~30secs
Distribution without encryption: ~0.4secs

Investigating this problem.

Found the stupid bug that caused the slowliness:

Each time a chunk gets encrypted and decrypted the SecretKey was newly derived in 65536 rounds from the channel password. This is obviously a huge computational effort done twice for every delivered data chunk.

Now the SecretKey is derived once during the start of Peergroup.