tags:

views:

121

answers:

2

Hai guys, I hve a web page that has to send an encrypted value to another page in my asp.net web application... I want to know

  • what is the best method to encrypt and decrypt a value using c#?
+4  A: 

If by efficient you mean efficient development (not implementing your own solution), I would say using the algorithms in the System.Security.Cryptography namespace. If instead you mean least-CPU-intensive, then probably rot 13 as mentioned by Matt Ellen. (Edit: As others have mentioned, rot 13 is not secure. Please consider that carefully.)

Between DES, 3DES, RC2, and Rijndael, this is what MS has to say:

With small data, we find that Rijndael, an AES (Advanced Encryption standard), is the fastest of all the methods. It has a variable block length and key length, which may be chosen to be any of 128, 192, or 256 bits. It also has a variable number of rounds to produce the cipher text, which depends on the key length and the block length.

Andy West
efficient and more secure :)
helios
+2  A: 

The method would depend on your use. I would not use rot 13 as it's nothing more than a basic letter replacement; not very secure.

I'd use 3DES or AES for any encryption.

Ariel