示例#1
0
        public void AssertThatEncrpyt1AndEncrypt1ReturnPlain()
        {
            var key         = "12345678";
            var plainText   = "abcdfeqe";
            var plaintAsBin = _block.ConvertStringToBinaryString(plainText);
            var cipher      = _logic.Encrpyt1(plainText, key);
            //var decryptedBin = "1";
            var decryptedBin = _logic.Decrpyt1(cipher, key);

            Assert.AreEqual(plaintAsBin, decryptedBin);
        }
示例#2
0
        private void txtDecrypt_Click(object sender, EventArgs e)
        {
            try
            {
                var block = new Block();

                var crpytionLogic = new CryptionLogic();
                this.rTxtOutput.AppendText(DateTime.Now.ToLongTimeString() + " Decrypt: " + this.txtCipherText.Text.Trim() + " Key: " + this.txtKeyField.Text.Trim());
                this.rTxtOutput.AppendText(Environment.NewLine);
                var outPut = crpytionLogic.Decrpyt1(this.txtCipherText.Text.Trim(), this.txtKeyField.Text.Trim());
                this.rTxtOutput.AppendText("Output: " + block.ConvertBinariesToText(outPut));
                this.rTxtOutput.AppendText(Environment.NewLine);
                this.rTxtOutput.AppendText("Binary: " + (outPut));
                this.rTxtOutput.AppendText(Environment.NewLine);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something happend. Error: " + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }