You should be able to output as_hex, break it into number-sized pieces and pack those. Not sure that's more elegant than going to a binary string. Maybe a little less bloated.
What exactly do you want to do with the encoded critters?
Caution: Contents may have been coded under pressure.