SHARE
TWEET

passchall

a guest Nov 14th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5. //password challenge
  6. void main()
  7. {
  8.     //requirements
  9.     int upper = '0';
  10.     int lower = '0';
  11.     int cashSymbol = '0';
  12.     int i = '0';
  13.     char myPassword[50];
  14.  
  15.     //grab password
  16.     //todo Why the fuck teach people to get BOFd by default?
  17.     printf("Please input your password!");
  18.     scanf("%s", myPassword);
  19.  
  20.     //check size
  21.     size_t arrayLength = sizeof(myPassword);
  22.  
  23.  
  24.     while(i < arrayLength){
  25.         if (upper == 0 || lower == 0 || cashSymbol == 0){
  26.             if ( isupper(myPassword[i]) ){
  27.                 upper = 1;
  28.                 i++;
  29.             }
  30.             else if ( myPassword[i] = "$" ) {
  31.                 cashSymbol = 1;
  32.                 i++;
  33.             }
  34.             else if ( islower(myPassword[i]){
  35.                 lower = 1;
  36.                 i++;
  37.             }
  38.             else {
  39.                 i++;
  40.             }
  41.         else if ( (upper = 0 || lower = 0 || cashSymbol = 0) && i = sizeof(arrayLength) {
  42.             printf("Did not find an upper, lower, and cash symbol in the password.");
  43.             break;
  44.         }
  45.         else{
  46.             printf("Upper, lower, and special symbol located. Great password.");
  47.         }  
  48.  
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top