Skip to content

Instantly share code, notes, and snippets.

@KarthikNayak
Created October 23, 2017 16:39
Show Gist options
  • Save KarthikNayak/23b4ccd5f529307d15a21de87dd1bb5b to your computer and use it in GitHub Desktop.
Save KarthikNayak/23b4ccd5f529307d15a21de87dd1bb5b to your computer and use it in GitHub Desktop.
30 Days of CTF: Day 2
#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