1 /* vi: set sw=4 ts=4: */
5 * Cooked from passwd.c by Thomas Lundquist <thomasez@zelow.no>
13 set TESTING to 1 and pipe some file through this script
14 if you played with bbox's crypt implementation.
17 n=`./busybox cryptpw -a des -- "$line"`
18 o=`./busybox_old cryptpw -a des -- "$line"`
19 test "$n" != "$o" && {
24 n=`./busybox cryptpw -- "$line"`
25 o=`./busybox_old cryptpw -- "$line"`
26 test "$n" != "$o" && {
34 int cryptpw_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
35 int cryptpw_main(int argc ATTRIBUTE_UNUSED, char **argv)
37 char salt[sizeof("$N$XXXXXXXX")];
39 if (!getopt32(argv, "a:", NULL) || argv[optind - 1][0] != 'd') {
41 /* Too ugly, and needs even more magic to handle endianness: */
42 //((uint32_t*)&salt)[0] = '$' + '1'*0x100 + '$'*0x10000;
43 /* Hope one day gcc will do it itself (inlining strcpy) */
44 crypt_make_salt(salt + 3, 4, 0); /* md5 */
46 strcpy(salt + 3, "ajg./bcf");
49 crypt_make_salt(salt, 1, 0); /* des */
55 puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_fgetline(stdin), salt, 1));