public static void Decrypt(byte[] bytes) { short[] BitKeys = new short[] { 6, 2, 8, 0, 6, 8, 9, 1 }; BitCryto m_bitCryto = new BitCryto(BitKeys); for (int i = 0, imax = bytes.Length; i < imax; ++i) { bytes[i] = m_bitCryto.Decode(bytes[i]); } }
public static void Decrypt(string inFile, string outFile) { byte[] bytes = File.ReadAllBytes(inFile); short[] BitKeys = new short[] { 6, 2, 8, 0, 6, 8, 9, 1 }; BitCryto m_bitCryto = new BitCryto(BitKeys); for (int i = 0, imax = bytes.Length; i < imax; ++i) { bytes[i] = m_bitCryto.Decode(bytes[i]); } File.WriteAllBytes(outFile, bytes); }
///// <summary> ///// 将远程调用的方法解码为具体的方法调用。 ///// </summary> ///// <param name="data">远程调用方法的二进制数组</param> public static Pluto Decode(Byte[] data) { Int32 unLen = 0; Pluto pluto; //string str = BitConverter.ToString(data, 0, data.Length); //LoggerHelper.Debug("pluto decode=" + str+"str length="+str.Length+"data length="+data.Length); var msgId = (MSGIDType)VUInt16.Instance.Decode(data, ref unLen); encryto.Reset(); int len = data.Length; for (int i = unLen; i < len; ++i) { data[i] = encryto.Decode(data[i]); } //LoggerHelper.Debug("unLen=" + unLen + "msgid=" + msgId); Mogo.Util.LoggerHelper.Debug("msg_id: " + msgId); switch (msgId) { case MSGIDType.CLIENT_RPC_RESP: pluto = RpcCallPluto.Create(); break; case MSGIDType.CLIENT_LOGIN_RESP: pluto = LoginPluto.Create(); break; case MSGIDType.CLIENT_NOTIFY_ATTACH_BASEAPP: pluto = BaseLoginPluto.Create(); break; case MSGIDType.CLIENT_ENTITY_ATTACHED: //LoggerHelper.Debug("start entity attached"); pluto = EntityAttachedPluto.Create(); break; case MSGIDType.CLIENT_AOI_NEW_ENTITY: pluto = AOINewEntityPluto.Create(); break; case MSGIDType.CLIENT_AOI_DEL_ENTITY: pluto = AOIDelEntityPluto.Create(); break; case MSGIDType.CLIENT_OTHER_ENTITY_POS_SYNC: pluto = OtherEntityPosSyncPluto.Create(); break; case MSGIDType.CLIENT_OTHER_ENTITY_POS_PULL: pluto = OtherEntityPosPullPluto.Create(); break; case MSGIDType.CLIENT_OTHER_ENTITY_TELEPORT: pluto = OtherEntityPosTeleportPluto.Create(); break; case MSGIDType.CLIENT_ENTITY_CELL_ATTACHED: pluto = EntityCellAttachedPluto.Create(); break; case MSGIDType.CLIENT_AOI_ENTITIES: pluto = AOIEntitiesPluto.Create(); break; case MSGIDType.CLIENT_AVATAR_ATTRI_SYNC: pluto = AvatarAttriSyncPluto.Create(); break; case MSGIDType.CLIENT_OTHER_ENTITY_ATTRI_SYNC: pluto = OtherAttriSyncPluto.Create(); break; case MSGIDType.CLIENT_ENTITY_POS_SYNC: pluto = EntityPosSyncPluto.Create(); break; case MSGIDType.CLIENT_ENTITY_POS_PULL: pluto = EntityPosPullPluto.Create(); break; case MSGIDType.CLIENT_ENTITY_POS_TELEPORT: pluto = EntityPosTeleportPluto.Create(); break; case MSGIDType.CLIENT_CHECK_RESP: pluto = CheckDefMD5Pluto.Create(); break; case MSGIDType.BASEAPP_CLIENT_REFUSE_RELOGIN: pluto = ReConnectRefusePluto.Create(); break; case MSGIDType.NOTIFY_CLIENT_DEFUSE_LOGIN: pluto = DefuseLoginPluto.Create(); break; default: pluto = NotImplementedPluto.Create(); break; } pluto.DoDecode(data, ref unLen); return(pluto); }