Using system; using system. net; using system. windows; using system. windows. controls; using system. windows. documents; using system. windows. ink; using system. windows. input; using system. windows. media; using system. windows. media. animation; using system. windows. shapes; using Microsoft. phone. controls; using system. security. cryptography; // created by: vakin time: 2011-12-15namespace microblogforwp7.classes. util {// convert the input string to byte Array // then use protecteddata and pre-defined byte array for encryption // the encrypted data is also a byte data // finally use convert. tobase64string get its corresponding string public class encrypt {// pre-defined byte array: byte [] Opt = new byte [] {1, 2, 4, 8, 16 }; /// <summary> /// encryption of the password /// </Summary> /// <Param name = "userpassword"> unencrypted password content </param> /// <returns> </returns> private string encryptpwd (string userpassword) {byte [] input = system. text. encoding. utf8.getbytes (userpassword); String result = convert. tobase64string (protecteddata. Protect (input, OPT); return result ;}/// <summary >/// decrypt and decode. Null // </Summary> /// <Param name = "userpassword"> encrypted password content </param> /// <returns> </returns> private string decryptpwd (string userpassword) {If (string. isnullorempty (userpassword) {// return NULL without an encrypted password;} byte [] Output = convert. frombase64string (userpassword); byte [] en = protecteddata. unprotect (output, OPT); string result = system. text. encoding. utf8.getstring (EN, 0, en. length); return result ;}}}