Pete's Linux Advent Calendar 2008

The 4th day

How to encrypt a password.

With Python you can encrypt a password the Linux way to get hashes that are used in the password database.
$ python -c 'from crypt import crypt; print crypt("passwort","<salt>")'
To get MD5-hashes the <salt> should look like $1$<8 chars>$. Example:
$ python -c 'from crypt import crypt; print crypt("passwort","$1$abcdefgh$")'
$1$abcdefgh$c1kHURIpOZdp.a6BTGmpI0

Pete's Linux Advent Calendar 2008

Valid HTML 4.01!

Comments? send mail to pkruse@arcor.de my monogram