Created
October 23, 2017 16:39
-
-
Save KarthikNayak/23b4ccd5f529307d15a21de87dd1bb5b to your computer and use it in GitHub Desktop.
30 Days of CTF: Day 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) | |
{ | |
int i, sum = 0; | |
if (argc != 2) { | |
printf("Improper input\nUsage: ./simple_keygen <KEY>\n"); | |
return -1; | |
} | |
for (i = 0; i < strlen(argv[1]); i++) { | |
sum = sum + (int)argv[1][i]; | |
} | |
if (sum == 1384) { | |
printf("Correct key. Congrats!\n"); | |
return 0; | |
} | |
printf("Incorrect key\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment