I wrote a simple code in pure C to benchmark AES-CBC-256 and RC2-CBC-128 from Openssl. My testing loops look like this:
for(i=0; i<tests; i++) { timer_start(); for(j=0; j<its; j++) { RC2_cbc_encrypt(input, enc_out, length, &key, iv_enc, RC2_ENCRYPT); } stop = timer_stop(); printf("%f\n",(stop / its) * 1000); } for(i=0; i<tests; i++) { timer_start(); for(j=0; j<its; j++) { AES_cbc_encrypt(input, enc_out, length, &enc_key, iv_enc, AES_ENCRYPT); } stop = timer_stop(); printf("%f\n",(stop / its) * 1000); } But something wrong is happening, on every machine I test my code I get strange results, that is, every time AES is faster than RC2. What could be the problem? I use getrusage to measure time (in my timers).
AES: 0.010898 0.010471 0.010531 RC2: 0.023261 0.023392 0.023224