Skip to content

Instantly share code, notes, and snippets.

@PabloMansanet
Created March 6, 2019 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PabloMansanet/ecf2ff7bd14bfad564154c67643c22df to your computer and use it in GitHub Desktop.
Save PabloMansanet/ecf2ff7bd14bfad564154c67643c22df to your computer and use it in GitHub Desktop.
void check(char *password)
{
size_t password_length;
char character_test;
uint char_counter;
int accumulator;
int number_from_char;
accumulator = 0;
char_counter = 0;
while( true ) {
password_length = strlen(password);
if (password_length <= char_counter) {
printf("Password Incorrect!\n");
return;
}
character_test = password[char_counter];
sscanf(&character_test,"%d",&number_from_char);
accumulator = accumulator + number_from_char;
if (accumulator == 0xf) break;
char_counter = char_counter + 1;
}
printf("Password OK!\n");
/* WARNING: Subroutine does not return */
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment