I am going to encrypt and decrypt a base64 that's an image. Now it needs to be fast. How fast does it take to encrypt and decrypt a file with RSA-OAEP for example?
And if it is too slow what is a faster (but still secure) alternative?
I am going to encrypt and decrypt a base64 that's an image. Now it needs to be fast. How fast does it take to encrypt and decrypt a file with RSA-OAEP for example?
And if it is too slow what is a faster (but still secure) alternative?
I don't think anyone will be able to give you an exact number, since we know neither:
What you're encrypting/decrypting
How big the file is
Your key size
Use case
Computer specifications
Other factors like language used etc.
All of the above will affect the speed of the process. This site provides some numbers that you can use to calculate how long it might take. It also lists other alternatives.
Operation | Milliseconds/Operation | Megacycles/Operation|
RSA 1024 Encryption 0.08 0.14
RSA 1024 Decryption 1.46 2.68
RSA is pretty slow and has some limitations. Therefore, a typical way to encrypt files using RSA is to first encrypt them using a symmetric cipher with a random key, and then encrypt that random key using RSA. Encrypting 200 KB this way will take somewhere around 10 milliseconds.