Type cast encode_hex as string

When passing in an int, ctype_xdigit returns false, but if cast to string, it passes, as expected