1 /* vi: set sw=4 ts=4: */
5 * Cooked from passwd.c by Thomas Lundquist <thomasez@zelow.no>
10 int cryptpw_main(int argc, char **argv);
11 int cryptpw_main(int argc, char **argv)
13 char salt[sizeof("$N$XXXXXXXX")];
15 if (!getopt32(argv, "a:", NULL) || argv[optind - 1][0] != 'd') {
17 /* Too ugly, and needs even more magic to handle endianness: */
18 //((uint32_t*)&salt)[0] = '$' + '1'*0x100 + '$'*0x10000;
19 /* Hope one day gcc will do it itself (inlining strcpy) */
20 crypt_make_salt(salt + 3, 4, 0); /* md5 */
22 crypt_make_salt(salt, 1, 0); /* des */
25 puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_getline(stdin), salt));