could you show me how you show place the returned value output in a textbox ?
Code:
using System;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
public class Crypto : Form {
Button buttonDisplayCrypto = new Button();
TextBox textBoxCrypto = new TextBox();
Label labelCrypto = new Label();
public Crypto() {
buttonDisplayCrypto.Location = new Point(50, 100);
buttonDisplayCrypto.Size = new Size(200, 30);
buttonDisplayCrypto.Text = "Post Crypto Value to Text Box";
buttonDisplayCrypto.Click += new System.EventHandler(this.buttonCalculate_Click);
this.Controls.Add(buttonDisplayCrypto);
textBoxCrypto.Location = new Point(10, 20);
textBoxCrypto.Size = new Size(250, 30);
textBoxCrypto.Text = "";
this.Controls.Add(textBoxCrypto);
labelCrypto.Location = new Point(10, 5);
labelCrypto.Size = new Size(154, 15);
labelCrypto.Text = "Crypto Value for Hello World";
this.Controls.Add(labelCrypto);
}
static private string Crypter(string Input)
{
//maakt werk object TextToUni.
System.Text.UTF8Encoding TextToUni = new System.Text.UTF8Encoding();
//Haalt de Bytes uit TextToUni en slaat het op.
byte [] Bytes = TextToUni.GetBytes(Input);
//maakt werkobject aan Encoder voor het encrypten.
System.Security.Cryptography.MD5CryptoServiceProvider Crypther =
new System.Security.Cryptography.MD5CryptoServiceProvider();
byte [] ByteHash = Crypther.ComputeHash(Bytes);
StringBuilder sBuilder = new StringBuilder();
for(int i = 0; i < ByteHash.Length; i++)
{
sBuilder.Append(ByteHash[i].ToString("x2"));
}
return sBuilder.ToString();
}
private void buttonCalculate_Click(object sender, System.EventArgs e) {
textBoxCrypto.Text = Crypter("Hello World");
}
public static void Main(string[] args) {
Application.Run(new Crypto());
}
}