Beispiel #1
0
        static void Main(string[] args)
        {
            Playfair szyfr = new Playfair("klucz");

            szyfr.show();
            Console.ReadKey();
        }
Beispiel #2
0
 void TextBoxKeywordTextChanged(object sender, EventArgs e)
 {
     this.pf = new Playfair.Playfair(this.textBoxKeyword.Text);
     if (cipher && !String.IsNullOrEmpty(this.textBoxCipher.Text))
     {
         this.textBoxDecipher.Text = this.pf.Cipher(this.textBoxCipher.Text);
     }
     else if (!cipher && !String.IsNullOrEmpty(this.textBoxDecipher.Text))
     {
         this.textBoxCipher.Text = this.pf.Decipher(this.textBoxDecipher.Text);
     }
 }
Beispiel #3
0
 void TextBoxKeywordTextChanged(object sender, EventArgs e)
 {
     this.pf = new Playfair.Playfair(this.textBoxKeyword.Text);
     if (cipher && !String.IsNullOrEmpty(this.textBoxCipher.Text))
     {
         this.textBoxDecipher.Text = this.pf.Cipher(this.textBoxCipher.Text);
     }
     else if (!cipher && !String.IsNullOrEmpty(this.textBoxDecipher.Text))
     {
         this.textBoxCipher.Text = this.pf.Decipher(this.textBoxDecipher.Text);
     }
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            string originalText = "A fost odata ca niciodata un mare rege";

            Console.WriteLine(originalText);
            string plainText = Playfair.Prepare(originalText);

            Console.WriteLine(plainText);
            //Exemplu de key de pe wikipedia
            string key        = "playfirexmbcdghknoqstuvwz";
            string cipherText = Playfair.Encipher(key, plainText);

            Console.WriteLine(cipherText);
            plainText = Playfair.Decipher(key, cipherText);
            Console.WriteLine(plainText);
            Console.ReadKey();
        }