I notice that encryption/decryption will be slow when doing with big files.
use byte_counter++ & (BLOCK_LEN -1) will be faster than byte_counter++ % BLOCK_LEN.
use EVP methods will be faster than aes-core:
$ openssl speed aes-256-cbc
Doing aes-256 cbc for 3s on 16 size blocks: 20421982 aes-256 cbc's in 2.99s
Doing aes-256 cbc for 3s on 64 size blocks: 5347742 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 256 size blocks: 1263704 aes-256 cbc's in 2.99s
Doing aes-256 cbc for 3s on 1024 size blocks: 308552 aes-256 cbc's in 2.96s
Doing aes-256 cbc for 3s on 8192 size blocks: 40526 aes-256 cbc's in 2.98s
LibreSSL 2.8.3
built on: date not available
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-256 cbc 109248.19k 114155.14k 108162.40k 106682.45k 111352.49k
$ openssl speed -evp aes-256-cbc
Doing aes-256-cbc for 3s on 16 size blocks: 171610892 aes-256-cbc's in 2.99s
Doing aes-256-cbc for 3s on 64 size blocks: 39061952 aes-256-cbc's in 2.94s
Doing aes-256-cbc for 3s on 256 size blocks: 9160896 aes-256-cbc's in 2.93s
Doing aes-256-cbc for 3s on 1024 size blocks: 2470343 aes-256-cbc's in 2.93s
Doing aes-256-cbc for 3s on 8192 size blocks: 349873 aes-256-cbc's in 3.00s
LibreSSL 2.8.3
built on: date not available
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-256-cbc 917066.85k 850782.25k 799582.06k 862127.79k 956856.91k
I notice that encryption/decryption will be slow when doing with big files.
byte_counter++ & (BLOCK_LEN -1)
will be faster than byte_counter++ % BLOCK_LEN.