object encrypt_packet(object packet, int version)
Encrypts a packet (including deflating and MAC-generation).