From owner-freebsd-questions Tue Jun 16 20:50:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA29572 for freebsd-questions-outgoing; Tue, 16 Jun 1998 20:50:31 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from nwalme.pair.com (nwalme.pair.com [209.68.1.123]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA29567 for ; Tue, 16 Jun 1998 20:50:27 -0700 (PDT) (envelope-from dima@nwalme.pair.com) Received: (from dima@localhost) by nwalme.pair.com (8.9.0/8.6.12) id XAA15807; Tue, 16 Jun 1998 23:49:54 -0400 (EDT) Message-Id: <199806170349.XAA15807@nwalme.pair.com> X-Envelope-To: freebsd-questions@FreeBSD.ORG Subject: Re: Password crypt To: panda@peace.com.my (chas) Date: Tue, 16 Jun 1998 23:49:54 -0400 (EDT) Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: <3.0.32.19980616224243.00a28210@peace.com.my> from chas at "Jun 16, 98 10:20:50 pm" From: Dima Dorfman X-Mailer: ELM [version 2.4ME+ PL22 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Basically the encrypt key should be the salt, a random string. > The following function works in Python (bear with me) : > > from crypt import * > def encryptpasswd(passwd): > salt = str(random.random())[2:4] > cryptpasswd = crypt(passwd, salt) > return cryptpasswd > > This function takes a string 'passwd' and > returns the encrypted password after a unix 'crypt'. > You don't need to understand Python to see that > I just use a 2 character string as the salt. > > The returned string 'cryptpasswd' is then put into the > master.passwd record; I then call pwd_mkdb and the > passwd works. Screwy, i know, but it works - since this > is a one-way hash as opposed to encryption/decryption. > > So, bottomline : try using a random 2 character string. > > chas > > > >We are developing an .html facility for members to change > >their password on-line. But, I've hit a snag: > > > >I've assigned the new password to: > > > > > > > >$newpasswd > > > >But now need to encrypt it. I know the function to do this is: > > > >crypt($newpasswd,encryption key) > > > >But I don't know what the encryption key should be. Can anyone help? > > > >Regards, > > > >d. > > > >+--------------------------------------------------------+ > >| Dean Hollister, | dean@odyssey.apana.org.au* | > >| Region Co-Ordinator, | 12840184 ICQ | > >| APANA, | | > >| Western Australia. | *finger A/C for DISCLAIMER | > >+--------------------------------------------------------+ > >ST:VOY Kess: "I wish people would stop talking to me as if > > I'm still a child! I'm three years old now!" > > > > > >To Unsubscribe: send mail to majordomo@FreeBSD.org > >with "unsubscribe freebsd-questions" in the body of the message > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- Dima Dorfman (dima@zwb.net) I love the smell of fdisk in the morning FreeBSD Rules! Micro$oft Sucks! http://www.FreeBSD.ORG/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message