String extensions

Encrypting strings

  • System.String::string Encrypt(this string self, string password)
    • Encrypts the string value using Rijndael algorithm and converts the result to Base64 encoded string.
  System.Console.WriteLine(
    "Text to be encrypted.".Encrypt("secret")
  );

  >> EfOSkt1p2yRO/TLxMJBcs/DeAa3MpMqkA1TMqZW/75czfOgGPqmTf6Nt1MsgRVHG

Decrypting strings

  • System.String::string Decrypt(this string self, string password)
    • Decrypts the Base64 encoded string value using Rijndael algorithm.
  System.Console.WriteLine(
    "EfOSkt1p2yRO/TLxMJBcs/DeAa3MpMqkA1TMqZW/75czfOgGPqmTf6Nt1MsgRVHG".Decrypt("secret")
  );

  >> Text to be encrypted.

Last edited Sep 17, 2010 at 9:05 AM by Yasas, version 6

Comments

No comments yet.