Binary encoding of messages