fork(2) download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. uint8_t get_int(char c)
  7. {
  8. if (c >= '0' && c <= '9') return c - '0';
  9. if (c >= 'A' && c <= 'F') return 10 + c - 'A';
  10. if (c >= 'a' && c <= 'f') return 10 + c - 'a';
  11. return -1;
  12. }
  13.  
  14. int main(void)
  15. {
  16. char buff[33];
  17. size_t size;
  18. size_t i;
  19. uint8_t *output;
  20.  
  21. fgets(buff, sizeof buff, stdin);
  22. size = strlen(buff) / 2;
  23. output = malloc(size);
  24.  
  25. for (i= 0; i < size; ++i)
  26. output[i] = get_int(buff[2*i]) * 16 + get_int(buff[2*i+1]);
  27.  
  28. for (i= 0; i < size; ++i)
  29. printf("%u ", output[i]);
  30.  
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0s 2144KB
stdin
daec3055df058e1c39e814ea76f6747e
stdout
218 236 48 85 223 5 142 28 57 232 20 234 118 246 116 126