/// <summary> /// Send Message /// </summary> void Send() { byte[] mahoa = Diff.MaHoaDiffie(nhankey, txtMessage.Text); byte[] dodai = BitConverter.GetBytes(mahoa.Length); byte[] initvector = Diff.IV; if (client != null && txtMessage.Text != string.Empty) { client.Send(dodai); client.Send(mahoa); client.Send(initvector); } }
/// <summary> /// Send Message /// </summary> void Send() { dateTimeIV = md5.maHoaMd5(DateTime.Now.ToString()); string time = dateTimeIV.Substring(0, 16); dateTimeIv = Encoding.UTF8.GetBytes(time); string a = txtFinalKey.Text.Substring(0, 32); byte[] key = Encoding.ASCII.GetBytes(a); string s = aes.EncryptString(txtMessage.Text, key, dateTimeIv); byte[] mahoa = Diff.MaHoaDiffie(nhankey, s); byte[] dodai = BitConverter.GetBytes(mahoa.Length); byte[] initvector = Diff.IV; txtInnitDiffi.Text = Convert.ToBase64String(initvector); if (client != null && txtMessage.Text != string.Empty) { client.Send(dodai); client.Send(mahoa); client.Send(initvector); } }