Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 2003 19:27:05 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        FreeBSD-questions@FreeBSD.ORG
Subject:   Re: Misc Questions.
Message-ID:  <20030125192705.GC44054@happy-idiot-talk.infracaninophi>
In-Reply-To: <3E32DDB6.7040308@potentialtech.com>
References:  <F66WZhKmcEntH4NnXoN0000e3f8@hotmail.com> <3E32DDB6.7040308@potentialtech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 25, 2003 at 01:55:50PM -0500, Bill Moran wrote:

> >2. What command can i use if I want to crypt a word and I see it=20
> >encrypoted just like the /etc/master.passwd file? For example, I want to=
=20
> >know how the password "foobar" would be encrypted in /etc/master.passwd=
=20
> >if It would be my real passwd.
>=20
> I don't know the answer to this one, check the source.

crypt(3) is the C language interface.  Or perl will let you get at it
=66rom the command line.  The format of the salt determines the
encryption algorithm used:

Eg. DES just uses two characters:

    % perl -e 'print crypt("password", "xx"), "\n";'
    xxj31ZMTZzkVA

whereas MD5 uses the 'Modular' format and an 8 character salt:

    % perl -e 'print crypt(q{password}, q{$1$xxxxxxxx$}), "\n";'
    $1$xxxxxxxx$UYCIxa628.9qXjpQCjM4a.

Only MD5 and DES are available in FreeBSD 4.x --- other systems may
support Blowfish using salts that start $2$

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

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?20030125192705.GC44054>