md5crypt.py
branchtls-sprint
changeset 1132 96752791c2b6
parent 0 b97547f5f1fa
child 1977 606923dff11b
--- a/md5crypt.py	Mon Mar 23 17:38:30 2009 +0100
+++ b/md5crypt.py	Mon Mar 23 17:55:59 2009 +0100
@@ -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