Commits

Kelvin Wong  committed 51e329f Draft

Removed the regex for stripping whitespace, it removed ws within the string which was not what was needed. Just the ends were stripped in the old version to remove the linefeed at the end

Also, the Base64 encoder for Py3 was not adding linefeeds as in Py2. Output from both now matches

  • Participants
  • Parent commits 9648fa5

Comments (0)

Files changed (1)

File django_scrypt/hashers.py

 
 
 PYTHON3 = sys.version_info >= (3, 0)
-EMPTY = ''
-WHITESPACE = re.compile(r'\s+')
 
 
 def base64(s):
     """Returns a Base64 encoded string"""
     if PYTHON3:
         import base64
-        return base64.b64encode(s)
+        return base64.encodestring(s)
     else:
         return s.encode('base64')
 
 
 def stripws(s):
-    """Strip whitespace using regular expressions"""
-    return re.sub(WHITESPACE, EMPTY, s)
+    """Return a copy of the string with leading and trailing characters
+    removed
+    """
+    return s.strip()
 
 
 def stringify(s):