From owner-freebsd-questions Tue Jun 16 08:05:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA20437 for freebsd-questions-outgoing; Tue, 16 Jun 1998 08:05:16 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dove.peace.com.my (peace.com.my [202.184.153.15]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA20427 for ; Tue, 16 Jun 1998 08:05:14 -0700 (PDT) (envelope-from panda@peace.com.my) Received: from lovebox (love.com.my [202.184.153.17]) by dove.peace.com.my (8.8.5/8.8.5) with SMTP id WAA12072; Tue, 16 Jun 1998 22:20:50 +0800 (SGT) Date: Tue, 16 Jun 1998 22:20:50 +0800 (SGT) Message-Id: <3.0.32.19980616224243.00a28210@peace.com.my> X-Sender: panda@peace.com.my X-Mailer: Windows Eudora Pro Version 3.0 (32) To: Dean Hollister , FreeBSD Qestions From: chas Subject: Re: Password crypt Cc: mjm@attila.apana.org.au Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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