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