md5crypt.py
changeset 1808 aa09e20dd8c0
parent 1132 96752791c2b6
child 1977 606923dff11b
--- a/md5crypt.py	Tue May 05 17:18:49 2009 +0200
+++ b/md5crypt.py	Thu May 14 12:48:11 2009 +0200
@@ -53,7 +53,7 @@
 
 
 def crypt(pw, salt, magic=None):
-    if magic==None:
+    if magic is None:
         magic = MAGIC
     # Take care of the magic string if present
     if salt[:len(magic)] == magic:
@@ -63,7 +63,7 @@
     salt = salt[:8]
     ctx = pw + magic + salt
     final = md5.md5(pw + salt + pw).digest()
-    for pl in range(len(pw),0,-16):
+    for pl in xrange(len(pw), 0, -16):
         if pl > 16:
             ctx = ctx + final[:16]
         else:
@@ -80,7 +80,7 @@
     # The following is supposed to make
     # things run slower. 
     # my question: WTF???
-    for i in range(1000):
+    for i in xrange(1000):
         ctx1 = ''
         if i & 1:
             ctx1 = ctx1 + pw