| 627 | } |
| 628 | |
| 629 | static int hexval(char x) |
| 630 | { |
| 631 | switch(x) |
| 632 | { |
| 633 | case '0': return 0; |
| 634 | case '1': return 1; |
| 635 | case '2': return 2; |
| 636 | case '3': return 3; |
| 637 | case '4': return 4; |
| 638 | case '5': return 5; |
| 639 | case '6': return 6; |
| 640 | case '7': return 7; |
| 641 | case '8': return 8; |
| 642 | case '9': return 9; |
| 643 | case 'a': |
| 644 | case 'A': return 10; |
| 645 | case 'b': |
| 646 | case 'B': return 11; |
| 647 | case 'c': |
| 648 | case 'C': return 12; |
| 649 | case 'd': |
| 650 | case 'D': return 13; |
| 651 | case 'e': |
| 652 | case 'E': return 14; |
| 653 | case 'f': |
| 654 | case 'F': return 15; |
| 655 | default: return -1; |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | static int byteval(const char *hex, unsigned char *dst) |
| 660 | { |