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); }
private void btnEncrypt_Click(object sender, EventArgs e) { try { var block = new Block(); var crpytionLogic = new CryptionLogic(); this.rTxtOutput.AppendText(DateTime.Now.ToLongTimeString() + " Encrypt: " + this.txtTextField.Text.Trim() + " Key: " + this.txtKeyField.Text.Trim()); this.rTxtOutput.AppendText(Environment.NewLine); var outPut = crpytionLogic.Encrpyt1(this.txtTextField.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); } }