md5crypt.py
branchstable
changeset 7879 9aae456abab5
parent 5771 c077df1d0333
child 8317 9c59258e7798
--- a/md5crypt.py	Tue Sep 27 16:04:30 2011 +0200
+++ b/md5crypt.py	Wed Sep 28 09:27:42 2011 +0200
@@ -41,7 +41,7 @@
 MAGIC = '$1$'                        # Magic string
 ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
 
-import hashlib as md5
+from hashlib import md5 # pylint: disable=E0611
 
 def to64 (v, n):
     ret = ''
@@ -63,7 +63,7 @@
     salt = salt.split('$', 1)[0]
     salt = salt[:8]
     ctx = pw + magic + salt
-    final = md5.md5(pw + salt + pw).digest()
+    final = md5(pw + salt + pw).digest()
     for pl in xrange(len(pw), 0, -16):
         if pl > 16:
             ctx = ctx + final[:16]
@@ -77,7 +77,7 @@
         else:
             ctx = ctx + pw[0]
         i = i >> 1
-    final = md5.md5(ctx).digest()
+    final = md5(ctx).digest()
     # The following is supposed to make
     # things run slower.
     # my question: WTF???
@@ -95,7 +95,7 @@
             ctx1 = ctx1 + final[:16]
         else:
             ctx1 = ctx1 + pw
-        final = md5.md5(ctx1).digest()
+        final = md5(ctx1).digest()
     # Final xform
     passwd = ''
     passwd = passwd + to64((int(ord(final[0])) << 16)