Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 1998 23:49:54 -0400 (EDT)
From:      Dima Dorfman <dima@zwb.net>
To:        panda@peace.com.my (chas)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Password crypt
Message-ID:  <199806170349.XAA15807@nwalme.pair.com>
In-Reply-To: <3.0.32.19980616224243.00a28210@peace.com.my> from chas at "Jun 16, 98 10:20:50 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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:
> >
> ><in perl>
> >
> >$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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806170349.XAA15807>