Created
May 19, 2011 18:37
-
-
Save Ell/981414 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void EncryptFile(string inputFile, string outputFile) | |
{ | |
int num; | |
string s = "h3y_gUyZ"; | |
byte[] bytes = new UnicodeEncoding().GetBytes(s); | |
string path = outputFile; | |
FileStream stream = new FileStream(path, FileMode.Create); | |
RijndaelManaged managed = new RijndaelManaged(); | |
CryptoStream stream2 = new CryptoStream(stream, managed.CreateEncryptor(bytes, bytes), CryptoStreamMode.Write); | |
FileStream stream3 = new FileStream(inputFile, FileMode.Open); | |
while ((num = stream3.ReadByte()) != -1) | |
{ | |
stream2.WriteByte((byte) num); | |
} | |
stream3.Close(); | |
stream2.Close(); | |
stream.Close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment