Exemple #1
0
        static void Main(string[] args)
        {
            //from string literal and string concatenation
            string fname, lname;

            fname = "Rowan";
            lname = "Atkinson";

            string fullname = fname + lname;

            Console.WriteLine("Full Name: {0}", fullname);

            //by using string constructor
            char[] letters   = { 'H', 'e', 'l', 'l', 'o' };
            string greetings = new string(letters);

            Console.WriteLine("Greetings: {0}", greetings);

            //methods returning string
            string[] sarray  = { "Hello", "From", "Tutorials", "Point" };
            string   message = String.Join(" ", sarray);

            Console.WriteLine("Message: {0}", message);

            //formatting method to convert a value
            DateTime waiting = new DateTime(2012, 10, 10, 17, 58, 1);
            string   chat    = String.Format("Message sent at {0:t} on {0:D}", waiting);

            Console.WriteLine("Message: {0}", chat);//from string literal and string concatenation

            Console.WriteLine("Enter input string: ");
            string input = Console.ReadLine();                      //taking string input from user

            EncryptDecryptClass encdec = new EncryptDecryptClass(); //encrypt decrypt class object

            string encryptedString = encdec.EncryptInput(input);    //encrypted string

            Console.WriteLine("Encrypted String: {0}", encryptedString);

            string decryptedString = encdec.DecryptInput(encryptedString); //decrypted string

            Console.WriteLine("Decrypted String: {0}", decryptedString);

            string textenograph = encdec.stringtenograph(encryptedString);

            Console.WriteLine("Textenographed String: {0}", textenograph);

            string decodetextenograph = encdec.decodestringtenograph(textenograph);

            Console.WriteLine("Decoded Textenographed String: {0}", decodetextenograph);

            string stringFromDecodeTextenograph = encdec.DecryptInput(decodetextenograph); //decrypted string

            Console.WriteLine("Decrypted Textenographed String: {0}", stringFromDecodeTextenograph);

            Console.Read();
        }
Exemple #2
0
        /// <summary>
        /// This function recovers the hidden string in the input text
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Decrypt_Click(object sender, EventArgs e)
        {
            textBox_Output.Text = "";
            string input = textBox_StegnographTextInput.Text; //String with hidden text

            if (input != string.Empty)
            {
                string stringToDecodeFromSentence = encdec.decodstenograph(input, l.Text); //Recover encrypted string
                string output = encdec.DecryptInput(stringToDecodeFromSentence);           //Recover original message
                textBox_Output.Text = output;
            }
            else
            {
                textBox_Output.Text = "Error: Please enter stenograph text input";
            }
        }