public void gui_key(string x) { Tao_p_g(); dh = new Diffie_hellman(p, g); string s = x + ";" + p + ";" + g + ";" + dh.Publickey; senddata(s); }
public void send_key_public(string[] mess) { SHA256 sha256 = SHA256Managed.Create(); p = Convert.ToInt32(mess[1]); g = Convert.ToInt32(mess[2]); dh = new Diffie_hellman(p, g); dh.Tao_key_chung(Convert.ToInt32(mess[3])); key = sha256.ComputeHash(Encoding.ASCII.GetBytes(Convert.ToString(dh.Key_Chung))); senddata(Convert.ToString("Receive_Key" + ";" + dh.Publickey)); txtkey.Text = Convert.ToBase64String(key); session = true; }