I tried to search stackoverflow for an answer to this particular question but couldn't find a good answer.
The BouncyCastle API offers a ton of different encryption algorithms for .NET. In this case I have to select an encryption algorithm for the following use case:
Encrypting several thousand short strings for storage in an unencrypted file, typical length 10-30 characters.
Encryption needs to be only moderately secure, all strings will be encrypted with the same key but a different initialization vector. Things like authorization (like in AES-GCM) are not needed.
Which encryption algorithm is both fastest and straightforward to apply for encrypting and decrypting such a set of several thousand small strings? I will store the encrypted data of each string as BASE64 in the file.
Thank you for your advice!
That processor still has AES-NI, so using it via AES.Create seems like the most logical thing to do. A high-end solution would be to create the CTR mode from the ECB (and cache the keystreams).
Otherwise, you are looking for a fast stream cipher in software. You can check if Salsa20 is working for you. Unfortunately, that's the only cipher supported by eStream that I can find in Bouncy Castle for C#.
Note that you may want to look for multi-threading and would certainly check to see if it's possible to use a sequential nonce when using a stream cipher, as generating a 128-bit random value for each cipher seems wasteful.