public bool HandlePacket(Peer peer, ENet.Packet packet, Channel channelId) { var data = packet.GetBytes(); // if channel id is HANDSHAKE we should initialize blowfish key and return if (channelId == Channel.CHL_HANDSHAKE) { return(HandleHandshake(peer, data)); } // every packet that is not blowfish go here if (data.Length >= 8) { ulong playerId = _peers.First(x => x.Value.Address.Equals(peer.Address)).Key; data = _blowfishes[playerId].Decrypt(data); } return(HandlePacket(peer, data, channelId)); }
public bool HandlePacket(Peer peer, ENet.Packet packet, Channel channelId) { var data = packet.GetBytes(); // if channel id is HANDSHAKE we should initialize blowfish key and return if (channelId == Channel.CHL_HANDSHAKE) { return(HandleHandshake(peer, data)); } // every packet that is not blowfish go here if (data.Length >= 8) { // TODO: each user will have his unique key data = _blowfish.Decrypt(data); } return(HandlePacket(peer, data, channelId)); }