From owner-freebsd-questions Sun Mar 23 21: 4:48 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B7A2237B401 for ; Sun, 23 Mar 2003 21:04:46 -0800 (PST) Received: from login.kvalito.no (login.kvalito.no [213.151.136.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CFE243F93 for ; Sun, 23 Mar 2003 21:04:46 -0800 (PST) (envelope-from sigsegv@login.kvalito.no) Received: by login.kvalito.no (Postfix, from userid 1166) id 8F4841276DA; Mon, 24 Mar 2003 06:04:57 +0100 (CET) To: tony@idk.com Subject: Re: Generating passwords Cc: questions@freebsd.org Message-Id: <20030324050457.8F4841276DA@login.kvalito.no> Date: Mon, 24 Mar 2003 06:04:57 +0100 (CET) From: sigsegv@login.kvalito.no (Jan-Espen Pettersen) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Monday 24 March 2003 05:38, Tony wrote: > Is there a program that will give unique passwords to be as login > passwords. I seems to always stumble over deciding what it do. > > Idealy the program would do somethin like running the backgound generating > passwords or random numbers and when asked generate a login password... > > Thanks > This C program will generate random passwords. /* Copyright (C) Jan-Espen Pettersen * This software is distributed WITHOUT ANY WARRANTY */ #include #include #include int main() { int min_lenght = 8; int max_lenght = 30; int a; long int b; char *c = "-abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ---_/*+1234567890!#---1234567890-"; char *d; long int e; srandomdev(); e = random(); e = min_lenght + (e % ((max_lenght - min_lenght) + 1)); printf("lenght=%d\n", e); e++; d = (char *) malloc(e); e--; d[e] = 0; a = 0; while (a < e) { b = random(); b = b % strlen(c); d[a] = c[b]; a++; }; printf("password=\"%s\"\n", d); }; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message