convert a hex string to base64