How can I benchmark RSA operations on my computer? I want to know about 4096-bit long keys on general computers. How many encryptions and decryptions are possible per second? All benchmarks I found only show 1024- and 2048-bit keys.
-
2$\begingroup$ As a rule of thumb, the private key operation will be 8 times and the public key operation 4 times as expensive than what RSA 2048 needs. $\endgroup$– CodesInChaosDec 7, 2012 at 12:19
-
$\begingroup$ But if you want high performance and high security, why RSA? You could use a ~256 bit (or if paranoid ~512 bit) elliptic curve. That's pretty fast and offers a security level of 128 bit (or 256 bit for a 512 bit curve). $\endgroup$– CodesInChaosDec 7, 2012 at 12:21
-
$\begingroup$ @CodesInChaos what is elliptic curve relation to RSA? $\endgroup$– maryDec 7, 2012 at 12:49
-
$\begingroup$ ECDH is a protocol not a key like RSA to distribute publicly .. $\endgroup$– maryDec 7, 2012 at 13:07
-
2$\begingroup$ That might help you : Benchmark $\endgroup$– Alexandre YamajakoDec 7, 2012 at 13:27
1 Answer
A "general computer" simply doesn't exist, test for yourself with this command:
openssl speed rsa
As an example here is the output on a Mac Pro 2007 withIntel Xeon 5130:
Doing 512 bit private rsa's for 10s: 67450 512 bit private RSA's in 9.95s
Doing 512 bit public rsa's for 10s: 961891 512 bit public RSA's in 9.94s
Doing 1024 bit private rsa's for 10s: 19914 1024 bit private RSA's in 9.93s
Doing 1024 bit public rsa's for 10s: 343029 1024 bit public RSA's in 9.98s
Doing 2048 bit private rsa's for 10s: 3101 2048 bit private RSA's in 10.00s
Doing 2048 bit public rsa's for 10s: 100363 2048 bit public RSA's in 10.00s
Doing 4096 bit private rsa's for 10s: 430 4096 bit private RSA's in 9.95s
Doing 4096 bit public rsa's for 10s: 27080 4096 bit public RSA's in 9.93s
OpenSSL 1.0.1 14 Mar 2012
built on: Tue Aug 21 05:18:48 UTC 2012
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_NO_TLS1_2_CLIENT -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
sign verify sign/s verify/s
rsa 512 bits 0.000148s 0.000010s 6778.9 96769.7
rsa 1024 bits 0.000499s 0.000029s 2005.4 34371.6
rsa 2048 bits 0.003225s 0.000100s 310.1 10036.3
rsa 4096 bits 0.023140s 0.000367s 43.2 2727.1
And here is the same command on a slightly more up-to-date mobile (aka laptop) CPU (Intel i5 2540M)
Doing 512 bit private rsa's for 10s: 178265 512 bit private RSA's in 10.00s
Doing 512 bit public rsa's for 10s: 2244112 512 bit public RSA's in 10.01s
Doing 1024 bit private rsa's for 10s: 52008 1024 bit private RSA's in 10.00s
Doing 1024 bit public rsa's for 10s: 792898 1024 bit public RSA's in 10.01s
Doing 2048 bit private rsa's for 10s: 7216 2048 bit private RSA's in 10.00s
Doing 2048 bit public rsa's for 10s: 232383 2048 bit public RSA's in 10.01s
Doing 4096 bit private rsa's for 10s: 1012 4096 bit private RSA's in 10.01s
Doing 4096 bit public rsa's for 10s: 62854 4096 bit public RSA's in 10.01s
OpenSSL 1.0.1e 11 Feb 2013
built on: Mon Jul 15 12:44:45 UTC 2013
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_NO_TLS1_2_CLIENT -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
sign verify sign/s verify/s
rsa 512 bits 0.000056s 0.000004s 17826.5 224187.0
rsa 1024 bits 0.000192s 0.000013s 5200.8 79210.6
rsa 2048 bits 0.001386s 0.000043s 721.6 23215.1
rsa 4096 bits 0.009891s 0.000159s 101.1 6279.1
-
$\begingroup$ Mine gets all the way up to 126 RSA private key ops :) $\endgroup$– Maarten Bodewes ♦Jan 4, 2015 at 4:20