Added a function to calculate a hex string.