internal byte[] PacketBuilder(ushort Identifier, ushort Version, byte[] Payload) { if (Identifier != 20100) { RC4.Encrypt(ref Payload); var Packet = new List <byte>(); Packet.AddUShort(Identifier); Packet.Add(0); Packet.AddUShort((ushort)Payload.Length); Packet.AddUShort(Version); Packet.AddRange(Payload); return(Packet.ToArray()); } else { var Packet = new List <byte>(); Packet.AddUShort(Identifier); Packet.Add(0); Packet.AddUShort((ushort)Payload.Length); Packet.AddUShort(Version); Packet.AddRange(Payload); return(Packet.ToArray()); } }
public static byte[] Encrypt(byte[] payload) { byte[] Encrypted = payload; RC4Core.Encrypt(ref Encrypted); return(Encrypted); }