public void DecryptTest()
        {
            string expected = "BLHAKDUKVZ";
            string result   = playfair.Decrypt("CIPHERTEXT");

            Assert.AreEqual(expected, result);
        }
Beispiel #2
0
        private void DecryptButton_Click(object sender, EventArgs e)
        {
            if (EncryptedText.TextLength < 1)
            {
                return;
            }

            switch (AlgorithmSelect.SelectedIndex)
            {
            case 0:
                var caesar = new Caesar((int)caesarShift.Value, string25Key.Text);
                NormalText.Text = caesar.Decrypt(EncryptedText.Text);
                break;

            case 1:
                var playfaire = new Playfair(string25Key.Text);
                NormalText.Text = playfaire.Decrypt(EncryptedText.Text);
                break;

            case 2:
                var rsa = new RSA(rsaPublicText.Text, rsaPrivateText.Text);
                NormalText.Text = rsa.Decrypt(EncryptedText.Text);
                break;


            default:
                break;
            }
        }
Beispiel #3
0
        private void ButtonDecrypt_Click(object sender, EventArgs e)
        {
            if (textBoxDecryptOriginal.TextLength == 0)
            {
                return;
            }
            var decrypt = chiper.Decrypt(textBoxDecryptOriginal.Text, textBoxKey.Text);

            textBoxDecrypt.Text = decrypt;
        }
Beispiel #4
0
        public void Unigraph_PlayfairTest()
        {
            char[]   ch       = new string(Utility.KeyedEnglishAlphabet("KRYPTOS")).Replace("J", "").ToCharArray();
            Playfair playfair = new Playfair(ch);

            cipher    = "";
            clear     = "";
            generated = "";
            for (int i = 0; i < 25; i++)
            {
                generated = playfair.GenerateRandomString().Replace("J", "I").Substring(0, 26);

                cipher = playfair.Encrypt(generated);
                clear  = playfair.Decrypt(cipher);

                //TODO: Write changing X to be the letter that came before it
                //Assert.AreEqual(generated, clear);
            }
        }
Beispiel #5
0
 private void PlayfairDecrypt_Click(object sender, EventArgs e)
 {
     PlayfairOutput.Text = Playfair.Decrypt(PlayfairInput.Text, PlayfairKeyword.Text);
 }