Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

std::string Server_Packet_Processor::Encode(const std::string& original)
{
	std::string encoded(original);

	if (SendMulti() == 0 || std::uint8_t(original[1]) == std::uint8_t(PacketFamily::Init))
		return encoded;

	encoded = SwapMultiples(encoded, SendMulti());
	encoded = Interleave(encoded);
	encoded = FlipMSB(encoded);

	return encoded;
}

std::string Server_Packet_Processor::Decode(const std::string& original)
{
	std::string decoded(original);

	if (RecvMulti() == 0 || std::uint8_t(original[1]) == std::uint8_t(PacketFamily::Init))
		return decoded;

	decoded = FlipMSB(decoded);
	decoded = Deinterleave(decoded);
	decoded = SwapMultiples(decoded, RecvMulti());
	decoded = DelSequenceByte(decoded);

	return decoded;
}