Re: how to create MD5 passwords
On Thu, Jan 24, 2002 at 08:56:56AM +0100, Rainer Sigl wrote:
> Hi everyone,
> please can me tell somebody how to make MD5 passwords in order
> to supply it to ftppasswd file?
You just need to call the standard crypt() function with the
apropriate arguments. You can use perl or python or C or
whatever to do it. e.g.:
$ python
Python 2.1.1 (#1, Nov 11 2001, 18:19:24)
[GCC 2.95.4 20011006 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import string
>>> import random
>>> import crypt
>>> saltchars = string.uppercase + string.lowercase + string.digits + "./"
>>> s = []
>>> for i in range(8):
... s.append(random.choice(saltchars))
...
>>> salt = "$1$" + string.join(s, "")
>>> passwd = "Password"
>>> print crypt.crypt(passwd, salt)
$1$e6TSyRDd$OcJO4kuY0I/mLED6n.tNi1
--
Michael Wood <mwood@its.uct.ac.za>
Reply to: