1
0
mirror of https://github.com/rudollee/Encryption.git synced 2025-06-07 07:46:09 +00:00

encrypted string from label to textbox

This commit is contained in:
wook 2017-04-27 02:17:40 +09:00
parent ddbd02b51a
commit 507f7417e6
2 changed files with 14 additions and 13 deletions

View File

@ -39,9 +39,9 @@
this.lblTextDecryptedResult = new System.Windows.Forms.Label(); this.lblTextDecryptedResult = new System.Windows.Forms.Label();
this.btnEncrypt = new System.Windows.Forms.Button(); this.btnEncrypt = new System.Windows.Forms.Button();
this.lblTextDecrypted = new System.Windows.Forms.Label(); this.lblTextDecrypted = new System.Windows.Forms.Label();
this.lblTextEncryptedResult = new System.Windows.Forms.Label();
this.lblTextEncrypted = new System.Windows.Forms.Label(); this.lblTextEncrypted = new System.Windows.Forms.Label();
this.lblTextFlat = new System.Windows.Forms.Label(); this.lblTextFlat = new System.Windows.Forms.Label();
this.txtEncrypted = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -107,11 +107,11 @@
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.txtEncrypted);
this.groupBox2.Controls.Add(this.txtFlat); this.groupBox2.Controls.Add(this.txtFlat);
this.groupBox2.Controls.Add(this.lblTextDecryptedResult); this.groupBox2.Controls.Add(this.lblTextDecryptedResult);
this.groupBox2.Controls.Add(this.btnEncrypt); this.groupBox2.Controls.Add(this.btnEncrypt);
this.groupBox2.Controls.Add(this.lblTextDecrypted); this.groupBox2.Controls.Add(this.lblTextDecrypted);
this.groupBox2.Controls.Add(this.lblTextEncryptedResult);
this.groupBox2.Controls.Add(this.lblTextEncrypted); this.groupBox2.Controls.Add(this.lblTextEncrypted);
this.groupBox2.Controls.Add(this.lblTextFlat); this.groupBox2.Controls.Add(this.lblTextFlat);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
@ -158,14 +158,6 @@
this.lblTextDecrypted.TabIndex = 0; this.lblTextDecrypted.TabIndex = 0;
this.lblTextDecrypted.Text = "Decrypted"; this.lblTextDecrypted.Text = "Decrypted";
// //
// lblTextEncryptedResult
//
this.lblTextEncryptedResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.lblTextEncryptedResult.Location = new System.Drawing.Point(106, 45);
this.lblTextEncryptedResult.Name = "lblTextEncryptedResult";
this.lblTextEncryptedResult.Size = new System.Drawing.Size(354, 23);
this.lblTextEncryptedResult.TabIndex = 0;
//
// lblTextEncrypted // lblTextEncrypted
// //
this.lblTextEncrypted.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.lblTextEncrypted.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
@ -184,6 +176,15 @@
this.lblTextFlat.TabIndex = 0; this.lblTextFlat.TabIndex = 0;
this.lblTextFlat.Text = "Flat Text"; this.lblTextFlat.Text = "Flat Text";
// //
// txtEncrypted
//
this.txtEncrypted.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.txtEncrypted.Location = new System.Drawing.Point(106, 45);
this.txtEncrypted.Name = "txtEncrypted";
this.txtEncrypted.Size = new System.Drawing.Size(354, 23);
this.txtEncrypted.TabIndex = 4;
this.txtEncrypted.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtFlat_KeyDown);
//
// Cryptography // Cryptography
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -214,10 +215,10 @@
private System.Windows.Forms.TextBox txtFlat; private System.Windows.Forms.TextBox txtFlat;
private System.Windows.Forms.Label lblTextDecryptedResult; private System.Windows.Forms.Label lblTextDecryptedResult;
private System.Windows.Forms.Label lblTextDecrypted; private System.Windows.Forms.Label lblTextDecrypted;
private System.Windows.Forms.Label lblTextEncryptedResult;
private System.Windows.Forms.Label lblTextEncrypted; private System.Windows.Forms.Label lblTextEncrypted;
private System.Windows.Forms.Label lblTextFlat; private System.Windows.Forms.Label lblTextFlat;
private System.Windows.Forms.Button btnEncrypt; private System.Windows.Forms.Button btnEncrypt;
private System.Windows.Forms.TextBox txtEncrypted;
} }
} }

View File

@ -45,8 +45,8 @@ namespace Encryption.Example
if (this.txtFlat.Text.Length > 0) if (this.txtFlat.Text.Length > 0)
{ {
this.lblTextEncryptedResult.Text = crypto.Encrypt(this.txtFlat.Text, this.KEYS[0], this.KEYS[1]); this.txtEncrypted.Text = crypto.Encrypt(this.txtFlat.Text, this.KEYS[0], this.KEYS[1]);
this.lblTextDecryptedResult.Text = crypto.Decrypt(this.lblTextEncryptedResult.Text, this.KEYS.ElementAt(0), this.KEYS.ElementAt(1)); this.lblTextDecryptedResult.Text = crypto.Decrypt(this.txtEncrypted.Text, this.KEYS.ElementAt(0), this.KEYS.ElementAt(1));
} }
else else
{ {