- 打卡等级:热心大叔
- 打卡总天数:354
- 打卡月天数:10
- 打卡总奖励:1622
- 最近打卡:2025-04-10 00:44:48
管理员
- 积分
- 1090
|
- public void Connect(string address, int port)
- {
- if (this.socket.Connected)
- {
- Debug.Log(string.Format("错误:重复建立Socke连接,重新连接时请先断开之前的连接", new object[0]));
- return;
- }
- this.address = address;
- this.port = port;
- MD5 md = MD5.Create();
- string a = "12546f1c61454538c45490";
- string a2 = "1252051ca54456902c7054bc";
- string a3 = "66610b45455576";
- string a4 = "4582fdgs4545wr42saf1";
- byte[] bytes = Encoding.Default.GetBytes(address);
- byte[] array = md.ComputeHash(bytes);
- string text = string.Empty;
- for (int i = 0; i < array.Length; i++)
- {
- text += array.ToString("x6");
- }
- byte[] bytes2 = Encoding.Default.GetBytes(text);
- byte[] array2 = md.ComputeHash(bytes2);
- string text2 = string.Empty;
- for (int j = 0; j < array2.Length; j++)
- {
- text2 += array2[j].ToString("x2");
- }
- if (!(a == text2) && !(a2 == text2) && !(a3 == text2))
- {
- if (!(a4 == text2))
- {
- this.Disconnect();
- return;
- }
- }
- try
- {
- Log.Debug("Socket尝试建立连接");
- this.ConnectStatus = ConnectStatusEnum.HasConnect;
- this.connetTime = Time.time;
- this.result = this.socket.BeginConnect(address, port, null, null);
- TimerManager.GetInstance().AddTimerTask(new TimerTask(500f, new Action(this.checkConnect)));
- }
- catch (SocketException ex)
- {
- this.result = null;
- this.socket.Close();
- Debug.Log(string.Format("连接服务器{0}:{1}失败:{2}", address, port, ex.Message));
- this.Disconnect();
- } }
address=ip地址
byte[] bytes = Encoding.Default.GetBytes(address);
byte[] array = md.ComputeHash(bytes);
string text = string.Empty;
for (int i = 0; i < array.Length; i++)
{
text += array.ToString("x6");
}
byte[] bytes2 = Encoding.Default.GetBytes(text);
byte[] array2 = md.ComputeHash(bytes2);
string text2 = string.Empty;
for (int j = 0; j < array2.Length; j++)
{
text2 += array2[j].ToString("x2");
}
text2就是最终密文
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |
|