Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char *argv[])
- {
- int res = 0;
- char buf[5];
- char *end;
- for (int i = 0; i < strlen(argv[1]); i+=4) {
- buf[0] = argv[1][i];
- buf[1] = argv[1][i+1];
- buf[2] = argv[1][i+2];
- buf[3] = argv[1][i+3];
- buf[4] = '\0';
- res ^= strtol(buf, &end, 16);
- }
- printf("Checksum 0x%x\n", res);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment