Introduce common method to convert hex digits