| Author: Gaddamchandrakanth 26 Jul 2008 | Member Level: Silver | Rating: Points: 6 |
Hi, Pls check with this once. this is for password encryption and decryption .
#region public static string Encrypt( string strHastobeEncryptWord) { byte[] sByBuf = Encoding.ASCII.GetBytes(strHastobeEncryptWord); for (int nCtr = 0; nCtr < sByBuf.Length; nCtr++) sByBuf[nCtr] = Convert.ToByte(Convert.ToInt64(sByBuf[nCtr]) + 4); string strEncryptedWord = Encoding.ASCII.GetString(sByBuf); return strEncryptedWord; }
#endregion Encryption Method
#region Decryption Method public static string Decrypt(string strPassword) { byte[] sByBuf = Encoding.ASCII.GetBytes(strPassword); for (int nCtr = 0; nCtr < sByBuf.Length; nCtr++) sByBuf[nCtr] = Convert.ToByte(Convert.ToInt64(sByBuf[nCtr]) - 4); string strDecrptedword = Encoding.ASCII.GetString(sByBuf); return strDecrptedword; }
Thanks and Regards Chandrakanth
|