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