See packing into a byte token for pack info regarding a very similar problem.
In reply to Re: pack and AES help needed by AnomalousMonk in thread pack and AES help needed by dbarstis