diff options
author | David Cantrell <dcantrell@redhat.com> | 2009-04-13 14:36:57 -1000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2009-04-13 15:40:37 -1000 |
commit | a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28 (patch) | |
tree | 2cc6f1e21555ef3cc1f5fcd6cf5916514243afa1 /users.py | |
parent | fb36d999f378c7685516d82a19a33c383e649599 (diff) | |
download | anaconda-a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28.tar.gz anaconda-a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28.tar.xz anaconda-a3c26e2a14577f6fe77c7085a46ab68cdf3ccb28.zip |
Default to SHA512 password encoding algorithm.
If algo is None by the time we get to cryptPassword(), force the use of
SHA512 for password encoding.
Diffstat (limited to 'users.py')
-rw-r--r-- | users.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -63,13 +63,17 @@ directory = %(instPath)s/etc # $5$ SHA256 # $6$ SHA512 def cryptPassword(password, algo=None): - salts = {'md5': '$1$', 'sha256': '$5$', 'sha512': '$6$', None: ''} - saltstr = salts[algo] + salts = {'md5': '$1$', 'sha256': '$5$', 'sha512': '$6$'} saltlen = 2 + if algo is None: + algo = 'sha512' + if algo == 'md5' or algo == 'sha256' or algo == 'sha512': saltlen = 16 + saltstr = salts[algo] + for i in range(saltlen): saltstr = saltstr + random.choice (string.letters + string.digits + './') |