move hex parser and generator to a header