Question

I don't know how could I measure the elapsed time in encryption using openssl.

I have downloaded openssl to my linux system with no problems and I can do encryption to different files but I don't know how to measure the time to see what encryption algorithm is more effecient.

Here is the command that I use to do the encryption:

 OpenSSL> enc -des-cbc -salt -a -in "/usr/local/openssl/file1.txt" -out "/usr/local/openssl/file1_des.enc" -k "123456"

This is the other algorithm:

 OpenSSL> enc -aes-128-cbc -salt -a -in "/usr/local/openssl/file2.txt" -out "/usr/local/openssl/file2_aes.enc" -k "123456"

Is there a way to measure the time of execution? I tried to open another terminal and execute the (time) but it didn't help. I also don't have that much of experice on using linux. However, I tried to do the same thing on Windows but still don't have a way to measure the time.

Hope you guys can help.

Thanks, D

Was it helpful?

Solution

On Linux, I entered this at the shell prompt:

 time openssl enc -des-cbc -salt -a -in foo.txt -out foo_des.enc -k "123456"

and got the output:

real    0m0.214s
user    0m0.008s
sys     0m0.016s

That said, you'd get a more meaningful result if you introduced some sort of looping construct. At the very least, consider creating a text file with multiple openssl command lines:

opensslcmds.txt:

enc -des-cbc -salt -a -in foo.txt -out file1_des.enc -k 123456
enc -des-cbc -salt -a -in foo.txt -out file2_des.enc -k 123456
enc -des-cbc -salt -a -in foo.txt -out file3_des.enc -k 123456
(and so on)

and then run

time openssl < opensslcmds.txt

OTHER TIPS

Eh, you mean like openssl speed?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top