using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Encryption { class Program { // Outputs the contents of Packet with Text prefix static void DisplayContents(mn.Packet Packet, string Text) { // Move cursor to start of packet Packet.SetCursor(0); // Return string containing contents of packet string Contents = Packet.GetString(Packet.GetUsedSize(),true); // Write packet contents to screen Console.WriteLine(Text); Console.WriteLine(Contents); } static void Main() { // Create key to be used when encrypting // The 4 parameters of mnCreateKey256 act as a password // Without these values it is impossible to decrypt the packet Int64 Key = mn.CreateKey256(1251521,15215215,121512515,151252151); // Get input Console.WriteLine("Enter data to be encrypted (max len = 1024):"); string Input = Console.ReadLine(); Console.WriteLine(); Console.WriteLine(); // Create packet from input mn.Packet Packet = new mn.Packet(Input); // Display packet contents DisplayContents(Packet,"Original contents: "); // Encrypt the packet using the key that we created earlier Packet.Encrypt(Key); // Display encrypted contents DisplayContents(Packet,"Encrypted contents: "); // Decrypt packet using the key that we created earlier Packet.Decrypt(Key); // Display decrypted contents DisplayContents(Packet,"Decrypted contents: "); Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }