Simple little/big endian hex encoder