#include #include #include #include int main(void) { int i, j; char salt_chars[64]; char salt[3] = {0, 0, 0}; for (i = 0, j = 0; i < 26; i++) { salt_chars[j++] = i + 'A'; salt_chars[j++] = i + 'a'; if (i < 10) salt_chars[j++] = i + '0'; } salt_chars[j++] = '.'; salt_chars[j++] = '/'; srand(time(NULL)); i = rand(); salt[0] = salt_chars[i & 63]; salt[1] = salt_chars[(i >> 6) & 63]; printf("%s\n", crypt(getpass("Password: "), salt)); return EXIT_SUCCESS; }