we are using the following code to decrypt a string with 39 characters (encrypted to 346 characters as base 64). Decrypting takes over 1 second. Using the TMS Cryptography Pack demo it's slow, too.
When using it in one of our containers which doesn't have a lot of performance it takes up to 40 seconds.
We also tried setting "withOpenSSL := true" and using "FromOpenSSLPrivateKey" with the same result.
When we use openssl.exe as a command line it takes about 10 to 20 miliseconds.
Is there a reason why it is so slow if the use TRSAEncSign? Any way to increase the speed? Did we use any wrong settings?
We need to use "epkcs1_5" in this case but also tried using oaep with no change in speed.
Hi,
RSA is slow in full Delphi mode (I think it's mentioned in the manual). It is due to at least 3 things: lots of checks, data structures and Delphi that is slower than C (the library was written in C up to 4.3, with Delphi wrappers).
I'll improve that in future releases but it will never be as fast as C code.
Regards,
bernard
Hi,
I am working on improving RSA, which is not granted without a major rewrite (so not now).
Just for you to know that running 64 bit tests is about 30% faster than runining identical tests in 32-bit mode on Windows.
Regards,
bernard
Hi,
I made a few changes in RSA that will appear in the next release.
Here is a simple benchmark on Windows, OSX and OSX ARM for 100 PKCS encryptions and decryptions with a 2048 bit key. 100 is for the fastest implementation (the key is generated before).
Windows 64: 100 ( i9-9880H CPU @ 2.30GHz) (~0.6 s per encryption/decryption sequence)
Windows 32: 150
OSX 64: 160 (2014 MacBook Air, i7 CPU @ 1.7 GHz)
OSX ARM (M1 Max): 140
For 4096 bit keys, multiply all results by ~4.
Conclusion: W32 is much slower than W64 and the M1 chip is a bit disappointing.