Reverse arguments for bin2hex and hex2bin so output is first
Use internal function for hex encoding