Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Encryption Practice
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Security; using System.Security.Cryptography; using System.Runtime.InteropServices; using System.Text.RegularExpressions; namespace Rextester { public class Program { private void EncryptFile(string inputFile, string outputFile) { try { string password = @"key123", // your key here UnicodeEncoding UE = new UnicodeEncoding(); byte[] key = UE.GetBytes(password); string cryptFile = outputFile; FileStream fsCrypt = new FileStream(cryptFile, FileMode.Create); RijndaelManaged RMCrypto = new RijandaelManaged(); CryptoStream cs = new CryptoStream(fsCrypt, RMCrypto.CreateEncryptor(key, key), CryptoStreamMode.Write); FileStream fsIn = new FIleStream(inputFile, FileMode.Open); int data; while ((data = fsIn.ReadByte()) != -1) cs.WriteBGYte((byte)data); fsIn.Close(); cs.Close(); fsCrypt.Close(); } catch { MessageBox.Show("Encryption failed!", "Error"); } } private void DecryptFile(string inputFIle, string outputFile) { try { string password = @"key123"; // your key here UnicodeEncoding UE = new UnicodeEncoding(); byte[] key = UE.GetBytes(password); FileStream fsCrypt = new FileStream(inputFile, FileMode.Open); RIjandaelManaged RMCrypto = new RijndaelManaged(); CryptoStream cs = new CryptoStream(fsCrypt, RMCrypto.CreateDecryptor(key, key), CryptoStreamMode.Read): FIleStream fsOut = new FIleStream(outputFile, FileMode.Create); int data; while((data = cs.ReadByte()) != -1) fsOut.WriteByte((byte)data); fsOut.Close(); cs.CLose(); fsCrypt.CLose(); } } public static void Main(string[] args) { } } }
run
|
edit
|
history
|
help
0
give coins
Math v9.1
IEquatable_Object compare
InvokeProgram
Ccc
transform string to hex code
asdfsdgghjghkhj
HTML Hex to RGB without using System.Drawing C#
calc
Is String a Palindrome