Add a hex2ip function for #4860