Guest User

Untitled

a guest
Apr 4th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. int main(int argc, char *argv[])
  5. {
  6. int res = 0;
  7. char buf[5];
  8. char *end;
  9. for (int i = 0; i < strlen(argv[1]); i+=4) {
  10. buf[0] = argv[1][i];
  11. buf[1] = argv[1][i+1];
  12. buf[2] = argv[1][i+2];
  13. buf[3] = argv[1][i+3];
  14. buf[4] = '\0';
  15. res ^= strtol(buf, &end, 16);
  16. }
  17. printf("Checksum 0x%x\n", res);
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment