1 /* simple password generator by Nelson Minar (minar@reed.edu)
2 * copyright 1991, all rights reserved.
3 * You can use this code as long as my name stays with it.
6 #define _XOPEN_VERSION 4
7 #define _XOPEN_SOURCE_EXTENDED
14 int main(int argc, char *argv[])
16 static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
21 srandom(time(0)); /* may not be the BEST salt, but its close */
22 salt[0] = saltChars[random() % 64];
23 salt[1] = saltChars[random() % 64];
30 if ((strchr(saltChars, salt[0]) == NULL) || (strchr(saltChars, salt[1]) == NULL))
31 fprintf(stderr, "illegal salt %s\n", salt), exit(1);
34 plaintext = getpass("plaintext: ");
36 printf("%s\n", crypt(plaintext, salt));