DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T m

⟦b38dcf92e⟧ TextFile

    Length: 1404 (0x57c)
    Types: TextFile
    Names: »mkpasswd.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Tools/mkpasswd/mkpasswd.c« 

TextFile

/* mkpasswd.c: generate encryped/encoed passwd */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Tools/mkpasswd/RCS/mkpasswd.c,v 5.0 90/09/20 16:27:31 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Tools/mkpasswd/RCS/mkpasswd.c,v 5.0 90/09/20 16:27:31 pp Exp Locker: pp $
 *
 * $Log:	mkpasswd.c,v $
 * Revision 5.0  90/09/20  16:27:31  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"

#ifdef BSD42
#define RAND random
#define SRAND srandom
#else
#define RAND rand
#define SRANDOM srand
#endif

char	*myname;

static void findpass ();

main (argc, argv)
int	argc;
char	**argv;
{
	extern char	*optarg;
	extern int	optind;
	int	opt;
	char	*pass;

	myname = argv[0];
	while((opt = getopt(argc, argv, "")) != EOF)
		switch (opt) {
		    default:
			fprintf (stderr, "Usage: %s", myname);
			break;
		}
	argc -= optind;
	argv += optind;


	findpass ();
	
}

char saltkeys[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./";
extern char *crypt ();

static void findpass ()
{
	char *pass, *epass;
	char saltc[3];
	time_t now;

	(void) time (&now);
	SRAND (now);

	saltc[0] = saltkeys[RAND () % ((sizeof saltkeys) - 1)];
	saltc[1] = saltkeys[RAND () % ((sizeof saltkeys) - 1)];
	saltc[2] = 0;

	pass = getpassword ("Password: ");
	epass = crypt (pass, saltc);
	
	bzero (pass, strlen (pass));
	
	printf ("%s\n", epass);
}