diff options
Diffstat (limited to 'password.py')
-rwxr-xr-x[-rw-r--r--] | password.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/password.py b/password.py index 3570cf4..fe861e0 100644..100755 --- a/password.py +++ b/password.py | |||
@@ -10,6 +10,7 @@ Algorithm information was collected for various sources around the web | |||
10 | and from analysis of the APR C code. | 10 | and from analysis of the APR C code. |
11 | """ | 11 | """ |
12 | 12 | ||
13 | |||
13 | def crypt_password(passwd): | 14 | def crypt_password(passwd): |
14 | """Generate Apache-style CRYPT password hash. | 15 | """Generate Apache-style CRYPT password hash. |
15 | """ | 16 | """ |
@@ -17,6 +18,7 @@ def crypt_password(passwd): | |||
17 | from apachelib.md5 import generate_short_salt | 18 | from apachelib.md5 import generate_short_salt |
18 | return crypt(passwd, generate_short_salt()) | 19 | return crypt(passwd, generate_short_salt()) |
19 | 20 | ||
21 | |||
20 | def sha_password(passwd): | 22 | def sha_password(passwd): |
21 | """Generate Apache-style SHA1 password hash. | 23 | """Generate Apache-style SHA1 password hash. |
22 | """ | 24 | """ |
@@ -24,8 +26,9 @@ def sha_password(passwd): | |||
24 | from base64 import b64encode | 26 | from base64 import b64encode |
25 | return "{SHA}%s" % b64encode(sha1(passwd).digest()) | 27 | return "{SHA}%s" % b64encode(sha1(passwd).digest()) |
26 | 28 | ||
29 | |||
27 | def md5_password(passwd): | 30 | def md5_password(passwd): |
28 | """Generate Apache-style MD5 password hash. | 31 | """Generate Apache-style MD5 password hash. |
29 | """ | 32 | """ |
30 | from apachelib.md5 import generate_md5 | 33 | from apachelib.md5 import generate_md5 |
31 | return generate_md5(passwd) | 34 | return generate_md5(passwd) |