Skip to content

Instantly share code, notes, and snippets.

@anishmm
anishmm / gist:7651927c1a151713e33a47ed2ea033d5
Created October 28, 2017 09:40
file decrypt code in C#
public static bool Decrypte(string fileIn, string fileOut)
{
string Password = "mypassword";
bool msg = true;
FileStream fsIn = new FileStream(fileIn, FileMode.Open, FileAccess.Read);
FileStream fsOut = new FileStream(fileOut, FileMode.OpenOrCreate, FileAccess.Write);
PasswordDeriveBytes pdb = new PasswordDeriveBytes(Password, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });
Rijndael alg = Rijndael.Create();
alg.Key = pdb.GetBytes(32);
alg.IV = pdb.GetBytes(16);