To encrypt and Decrypt string in C#. Which algorithm is best and Why?
Loading
To encrypt and Decrypt string in C#. Which algorithm is best and Why?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Jan 30, 2023, 1:43 AM EST
please follow this article, some more often used algos are discussed
https://code-maze.com/csharp-string-encryption-decryption/
Uday DodiyaRank #239 · 10.3K reputationPosted Jan 30, 2023, 2:11 AM EST
The best algorithm to encrypt and decrypt a string in C# depends on the use case, but some popular options include:
AES (Advanced Encryption Standard) - Symmetric encryption algorithm that is fast, secure and widely used.
RSA - Asymmetric encryption algorithm that is slower but more secure and used for secure key exchange.
Triple DES - Legacy symmetric encryption algorithm that provides a good balance of speed and security.
Ultimately, the best algorithm for you will depend on the specific requirements of your use case, such as the size of the data to be encrypted, the security level needed, and the available processing power.
AES is often considered a good default option as it is widely used and has been reviewed extensively by the cryptography community.
Vishal JoshiRank #377 · 6.7K reputationPosted Jan 30, 2023, 2:14 AM EST
Hello Naimish
256-bit AES (Advanced Encryption Standard) encryption would be good, with a secret key also generating IV which is a unique value for data being encrypted. use the strong secret key.
you can also use SQL server data encryption.
Thank you