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.
12 #include "../../config/setup.h"
22 extern char *getpass();
24 int main(int argc, char *argv[])
26 static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
31 srandom(time(0)); /* may not be the BEST salt, but its close */
32 salt[0] = saltChars[random() % 64];
33 salt[1] = saltChars[random() % 64];
40 if ((strchr(saltChars, salt[0]) == NULL) || (strchr(saltChars, salt[1]) == NULL))
41 fprintf(stderr, "illegal salt %s\n", salt), exit(1);
44 plaintext = getpass("plaintext: ");
46 printf("%s\n", crypt(plaintext, salt));