#define _XOPEN_SOURCE 500 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <crypt.h> int main(int argc, char * argv[]) { puts(crypt(getpass("Password: "), crypt_gensalt( argc >= 2 ? argv[1] : NULL, argc >= 3 ? atoi(argv[2]) : 0, NULL, 0 ))); return EXIT_SUCCESS; }