void Send()
        {
            dateTimeIV = md5.maHoaMd5(DateTime.Now.ToString());
            string time = dateTimeIV.Substring(0, 16);

            dateTimeIv = Encoding.UTF8.GetBytes(time);
            string a = textBox4.Text.Substring(0, 32);

            byte[] key = Encoding.ASCII.GetBytes(a);

            int    paddingValue  = AddPadding();
            string _paddingValue = paddingValue.ToString();
            string s             = aes.EncryptString(textBox1.Text + "|" + _paddingValue, key, dateTimeIv);


            byte[] mahoa      = Diff.MaHoaDiffie(nhankey, s);
            byte[] dodai      = BitConverter.GetBytes(mahoa.Length);
            byte[] initvector = Diff.IV;
            if (client != null && textBox1.Text != string.Empty)
            {
                client.Send(dodai);
                client.Send(mahoa);
                client.Send(initvector);
            }
        }
Пример #2
0
        void Send(string message)
        {
            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(message, key, dateTimeIv);

            byte[] mahoa      = Diff.MaHoaDiffie(nhankey, s);
            byte[] dodai      = BitConverter.GetBytes(mahoa.Length);
            byte[] initvector = Diff.IV;
            if (client != null && txtMS.Text != string.Empty)
            {
                client.Send(dodai);
                client.Send(mahoa);
                client.Send(initvector);
            }
        }