How to use the .NET ICryptoTransform interface in C#

The ICryptoTransform interface represents blockwise cryptographic transformation which could be an encryption, ecryption, hashing, Base64 encoding/decoding, or formatting operation.  You can create an ICryptoTransform object for a given algorithm by using the:

–   CreateEncryptor() method – if you want to encrypt data.

–   CreateDecryptor() method – if you want to encrypt data.

The next code lines illustrate this approach:

 

TripleDES crypt = TripleDES.Create();

ICryptoTransform transform = crypt.CreateEncryptor();