MD5-HMAC 2x as slow after call to gcry_create_nonce
Ian Goldberg
linux at paip.net
Thu Feb 28 00:12:08 CET 2013
This is odd. It appears that if we call gcry_create_nonce in our
program, subsequent calls to MD5-HMAC are about 2.5x as slow as when we
don't. The source for a test program is attached. The second argument
controls whether a call to gcry_create_nonce is done before the timing
loop begins.
[The raw speeds are slow because I ran it on a netbook, but the 2.5x
difference is bizarre to me.]
$ gcc -Wall -o hmac_speed hmac_speed.c -lgcrypt
$ ./hmac_speed 100000 0
* Test gcrypt for 100000 trials: 1235895 us
$ ./hmac_speed 100000 0
* Test gcrypt for 100000 trials: 1232025 us
$ ./hmac_speed 100000 0
* Test gcrypt for 100000 trials: 1210038 us
$ ./hmac_speed 100000 1
* Test gcrypt for 100000 trials: 3180297 us
$ ./hmac_speed 100000 1
* Test gcrypt for 100000 trials: 3187211 us
$ ./hmac_speed 100000 1
* Test gcrypt for 100000 trials: 3207117 us
Any thoughts?
Thanks,
- Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hmac_speed.c
Type: text/x-csrc
Size: 1729 bytes
Desc: not available
URL: </pipermail/attachments/20130227/4582cc25/attachment-0001.c>
More information about the Gcrypt-devel
mailing list