Fixed conversion of digest to hex