Return true if the byte ordinal 'c' is a hexadecimal digit in ASCII.
(c)
| 170 | |
| 171 | # Other helper functions |
| 172 | def ishex(c): |
| 173 | """Return true if the byte ordinal 'c' is a hexadecimal digit in ASCII.""" |
| 174 | assert isinstance(c, bytes) |
| 175 | return b'0' <= c <= b'9' or b'a' <= c <= b'f' or b'A' <= c <= b'F' |
| 176 | |
| 177 | def unhex(s): |
| 178 | """Get the integer value of a hexadecimal number.""" |