Skip to main content

Posts

Showing posts with the label Data Decryption using C# Code

Data Decryption using C# Code

Data Decryption using C# Code public static byte[] Decryptor(string secrpcnm, string key) { byte[] b = Convert.FromBase64String(secrpcnm); TripleDES des = CreateDES(key); ICryptoTransform ct = des.CreateDecryptor(); byte[] output = ct.TransformFinalBlock(b, 0, b.Length); return Convert.FromBase64String(Encoding.Unicode.GetString(output)); } static TripleDES CreateDES(string key) { MD5 md5 = new MD5CryptoServiceProvider(); TripleDES des = new TripleDESCryptoServiceProvider(); des.Key=md5.ComputeHash(Encoding.Unicode.GetBytes(key)); des.IV = new byte[des.BlockSize / 8]; return des; } //And to call the functions on the click event of a button:: private void button4_Click(object sender, EventArgs e) { label6.Text = (EncrypCls.Decryptor(label5.Text, "sksdege")).ToString(); }