Advertisement
Adm1n_0v3rride

C password generator

Jun 3rd, 2017
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. # include <time.h>
  2. # include <stdio.h>
  3. # include <stdlib.h>
  4.  
  5. int
  6. main(void)
  7. {
  8.     /* You can change the length of the password */
  9.     unsigned short int length = 8;
  10.  
  11.     /* Seed number for rand() */
  12.     srand((unsigned int) time(0));
  13.  
  14.     /* ASCII characters 33 to 126 */
  15.     while(length--) {
  16.         putchar(rand() % 94 + 33);
  17.     }
  18.  
  19.     printf("\n");
  20.  
  21.     return EXIT_SUCCESS;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement