SHARE
TWEET

Untitled

a guest Sep 13th, 2017 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void GenPass(int length);
  5.  
  6. int main()
  7. {
  8.     int lengthOfPass;
  9.    
  10.     printf("Enter how many characters you want: ");
  11.         scanf("%d", &lengthOfPass);
  12.    
  13.     GenPass(lengthOfPass);
  14.    
  15.     return 0;
  16. }
  17.  
  18. void GenPass(int length)
  19. {
  20.     int start, random;
  21.     char characters[] = "abcdefghijklmnopqrstuvwxyz0123456789";
  22.     char *newpass;
  23.    
  24.     for(start = 0; start == length; start++)
  25.     {
  26.         random = rand()%36;
  27.         strcat(newpass, characters[random]);
  28.     }
  29.    
  30.     printf("Your password is: %s", newpass);
  31. }
RAW Paste Data
Top