TODO:find the algorithm to extract a hex