> From: [email protected] On Behalf Of loody
> Sent: Friday, 22 April, 2011 08:56

> hi all:
> I am quite curious about the format of openssl speed of digest.
> Take sha1 for example, below are the results on my machine:
> 
> The 'numbers' are in 1000s of bytes per second processed.
> type             16 bytes     64 bytes    256 bytes   1024 
> bytes   8192 bytes
> sha1              1194.73k     4306.66k    12037.87k    
> 22205.05k    29099.29k
> 
> if I remember correctly, the input vector of SHA1 is fixed and the
> unit of input is 512 bits,

Sort of. The internal compression block size is 512 bits, 
but the hash is defined to iterate over input of variable 
size (up to about 2^32) using Merkle-Damgard padding.
(The standard hash is actually defined for input in bits, 
but the OpenSSL API only allows byte/octet granularity.)
IV is *initialization* vector, and is indeed fixed.

> what is the "type" above used for?

The 'speed' commandline utility can do all (or nearly all) 
supported algorithms, so in general you get one line for 
type=sha1, one for type=md5, one for type=des, etc.

> if I have a data which size is 4MB, the speed of sha1 adopted from
> above should be
> 4*1024*1024/1194000 = 3.51 second, right?

For a single 4MB block of data, probably not.

The 'speed' figures are for complete processing 
(Init to Finish) of blocks of the given size, 
and the init and finish (and EVP!) overhead 
is larger relative to the data for small data.
Unless you do something silly like call Update 
for many small chunks of your data (in a loop) 
you should get overhead even less than for 8k.

But on modern general-purpose systems lots of things 
can affect performance. The only way to be sure is to 
measure, in as realistic an environment as possible.



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to