示例#1
0
 public byte[] hash_function(byte[] packet)
 {
     //object _loc5_ = null;
     //byte[] _loc6_ = null;
     if (this._hashKey == null)
         return packet;
     using (CustomDataWriter writer = new CustomDataWriter())
     {
         writer.WriteBytes(packet);
         CustomDataWriter writer2 = new CustomDataWriter();
         writer2.WriteBytes(this.hash(packet));
         using (RijndaelManaged myRijndael = new RijndaelManaged())
         {
             myRijndael.GenerateIV();
             // Encrypt the string to an array of bytes. 
             byte[] encrypted = EncryptStringToBytes(writer2.Data.ToString(), this._hashKey, myRijndael.IV);
         }
         writer.WriteBytes(writer2.Data);
         return writer.Data;
     }
 }
示例#2
0
        public void Send(Guid guid, TransitionMessage message, bool isRequest)
        {
            CustomDataWriter writer = new CustomDataWriter();

            writer.WriteBoolean(isRequest);
            byte[] guidDatas = guid.ToByteArray();
            writer.WriteInt(guidDatas.Length);
            writer.WriteBytes(guidDatas);

            message.Pack(writer);
            var packet = writer.Data;

            Send(packet);
            if (SSyncCore.ShowProtocolMessage)
            {
                logger.Color2(string.Format("Send {0}", message.ToString()));
            }
        }