Mask to hex