Linux, IBM notebook, Celeron, CPU:1.70GHz
A long array of random numbers is produced ahead of time ( of size equal to
NumberofPayload * Payload). Then
enter into a loop like:
Increment=PayloadSize-1;
Start=1;
Stop=Start+increment;
Start Timer
For k=1:NumberofPayload,
Encrypt(data(Start:Stop));
Start+=PayloadSize;
Stop+=PayloadSize;
End;
End Timer
The idea is that we don't spend overhead doing the generate random bits function
when we are timing. The only overhead is the loop increments and pointer
redirection.
Wenyuan, Qing and I decide to set the length of array as 8192 blocks of a block cipher. As for DES, it would be 8192 * 8 =65536 bytes. Though different algorithms have different block sizes or no blocks at all, we set this array size as 65536 in order to make the results of different algorithms more comparable.
For a block cipher, there are five modes of operations: CBC, ECB, CTR, CFB and OFB. I tested DES, 2DES, 3DES, XDES, AES(128, 192, 156 bit key) with each mode. Because there is little difference of timing performance between these five modes, I only test CBC mode for other block cipher algorithms. What's more, as for DES and AES, I only list the result with CBC mode.
Symmetric Key Algorithms | Name | Encryption (s) | Decryption (s) | Average | Speed (Mb/s) |
DES | 0.015527 | 0.016129 | 0.015828 | 33.1 | |
2DES | 0.025493 | 0.026297 | 0.025895 | 20.2 | |
3DES | 0.025403 | 0.026667 | 0.026035 | 20.1 | |
XDES | 0.013211 | 0.013711 | 0.013461 | 38.9 | |
AES (128 bit key) | 0.006835 | 0.007049 | 0.006942 | 75.5 | |
AES (192 bit key) | 0.006775 | 0.007377 | 0.007076 | 74.1 | |
AES (256 bit key) | 0.006997 | 0.007603 | 0.007300 | 71.8 | |
RC2 | 0.047415 | 0.038164 | 0.042790 | 12.3 | |
RC4 | 0.002368 | 0.002560 | 0.002464 | 212.8 | |
RC5 | 0.010440 | 0.010904 | 0.010672 | 49.1 | |
RC6 | 0.010161 | 0.010708 | 0.010435 | 50.2 | |
Twofish | 0.013113 | 0.013685 | 0.013399 | 39.1 | |
Blowfish | 0.010805 | 0.010211 | 0.010508 | 49.9 | |
IDEA | 0.021733 | 0.022166 | 0.021950 | 23.9 |
Conclusion:
Hash & MAC algorithms | Name | Hash (s) | Speed (Mb/s) |
SHA-1 | 0.015261 | 34.4 | |
MD5 | 0.004269 | 122.8 | |
RIPEMD | 0.013770 | 38.1 | |
HMAC (use SHA-1) | 0.035794 | 14.6 |
Conclusion:
Public Key Algorithms | Name | Generation keys (s) | Sign (s) | Verify Signature (s) | Encryption (s) | Decryption (s) |
RSA | 3.25469 | 11.86 | 0.877952 | 1.08192 | 11.9734 | |
speed (Mb/s) | 0.161 | 0.044 | 0.597 | 0.485 | 0.044 |
Conclusion: