private void button1_Click(object sender, EventArgs e) { MACHandler mh = new MACHandler(comboBoxMAC.Text); byte[] mac = mh.ComputeMAC(myConverter.StringToByteArray(textBoxPlain.Text), myConverter.StringToByteArray(textBoxKey.Text)); textBoxMAC.Text = myConverter.ByteArrayToString(mac); textBoxMACHEX.Text = myConverter.ByteArrayToHexString(mac); }
private void GetHashTime_Click(object sender, EventArgs e) { MACHandler myMAC = new MACHandler(comboBoxMAC.Text); long startTime = DateTime.Now.Ticks; int count = 10000000; byte[] hashValue = myMAC.ComputeMAC(myConverter.StringToByteArray(textBoxPlain.Text), myConverter.StringToByteArray(textBoxKey.Text)); textBoxMAC.Text = myConverter.ByteArrayToString(hashValue); textBoxMACHEX.Text = myConverter.ByteArrayToHexString(hashValue); double operationTime = (DateTime.Now.Ticks - startTime); operationTime = operationTime / (10 * count); HashTime.Text = "Hash time: " + operationTime.ToString() + " us"; }