[PATCH v2 14/18] lib: Add a function to convert a string to a hex value