[WF-Infra] CVS

John R. Sheets dusk at ravendusk.org
Sat Mar 3 09:57:20 PST 2001

On Feb 25, 2001, Tommi Laukkanen <tommi.laukkanen at hut.fi> wrote:
> How do I encrypt the password?

Try something like this:

#!/usr/bin/perl -w
$passwd = crypt ("mypassword", "salt");
print "$passwd\n";

Hack in your password and salt.  The salt is just some meaningless
string of characters to give the encryption some bite, IIRC.  Often,
people will salt their password with their user name.  crypt() will
tack the first two characters of the salt onto the front of the
encrypted string (the GNOME project encourages this).  For example,
crypt ("mypassword", "jsheets") gives an encrypted string of

I'm just passing on what other people have told me, so take this with
a -- erhum -- grain of salt.  If you have doubts, you can always try
pasting the generated encrypted string into some account in your
/etc/passwd file and try to log in with that password.  (c;


dusk at ravendusk.org                            http://www.gnome.org
jsheets at codeweavers.com                  http://www.worldforge.org
jsheets at users.sourceforge.net     http://openbooks.sourceforge.net

                   Writing GNOME Applications

More information about the Infra mailing list