title: AES faster than RSA Encryption?
body: <p>I am trying to test the speed of RSA and AES with openssl in ubuntu.</p>
  
  <p>i used the following code to test it.</p>
  
  <pre><code>echo -n "0123456789012345" &gt; message.txt
  
  openssl genrsa -out private.pem 1024
  openssl rsa -in private.pem -out public.pem -pubout
  
  
  for i in {1..1000}
  do
      openssl rsautl -encrypt -inkey public.pem -pubin -in message.txt -out message_enc.txt
  done
  
  for i in {1..1000}
  do
      openssl rsautl -decrypt -inkey private.pem -in message_enc.txt -out message_dec.txt
  done
  
  for i in {1..1000}
  do
      openssl enc -e -aes-128-cbc -in message.txt -out aes.bin -K ddf -iv 345
  
  done
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>$ time ./rsa_enc 
  real    0m3.697s
  user    0m1.308s
  sys     0m0.680s
  
  $ time ./rsa_dec
  real    0m14.273s
  user    0m3.172s
  sys     0m0.696s
  
  $ time ./aes
  
  real    0m3.790s
  user    0m1.408s
  sys     0m0.500s
  </code></pre>
  
  <p>It shows that RSA encrypt is faster then AES encrypt.</p>
  
  <p>Shouldn't AES be faster? Am  I doing anything incorrectly?</p>
  
  <p>Thanks.</p>