# Why Stream Ciphers can be slower in software than Block Ciphers

I made some tests on virtual environment (Virtual Box) using StrongSwan, a VPN based on IPSec. I had latency results using ping command saying that Chacha20 (stream cipher) had poor performance comparing with AES and BLowfish (Block ciphers).

How is this possible since stream ciphers should be faster than block ciphers?

• Why do you think stream ciphers should be faster? AES is typically slower than ChaCha20 in pure software, but faster if you have hardware acceleration such as AESNI which almost all x86 processors have these days. – Gilles 'SO- stop being evil' Jun 29 '19 at 21:28
• Well I think this based in many tests with strongswan (IPSEC), using aes, 3des, blowfish and chacha20 as cipher. All tests using block ciphers algorythms had less latency than stream cipher. The test were made with virtual machines. – André Luiza Jun 30 '19 at 22:05

Almost everything depends on the hardware platform the algorithm is implemented for and specifics of the implementation. So really one cannot say "algorithm x is faster than y" without referring to the specific hardware platform. For example, this page https://bearssl.org/speed.html contains a couple of benchmarks. Taking amd64 as the platform, if we have no AES-NI acceleration, Chacha20 beats AES-128-CTR. However, if we do have AES-NI, the situation reverses and AES-128-CTR is a couple of times faster than Chacha20.

If you want to test various algorithm implementations on your machine, you can play e.g. with openssl benchmarking tool

openssl speed -evp aes-128-ctr
openssl speed -evp chacha20-poly1305