Utilities/crypto/__init__.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 2997
7f0ef975da9e
child 3058
0a02c433f52d
--- a/Utilities/crypto/__init__.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Utilities/crypto/__init__.py	Fri Oct 18 23:00:41 2013 +0200
@@ -19,9 +19,9 @@
 
 import Preferences
 
-################################################################################
+###############################################################################
 ## password handling functions below
-################################################################################
+###############################################################################
 
 
 EncodeMarker = "CE4"
@@ -39,8 +39,10 @@
     @param pw password to encode (string)
     @return encoded password (string)
     """
-    pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,;:-_!$?*+#"
-    rpw = "".join(random.sample(pop, 32)) + pw + "".join(random.sample(pop, 32))
+    pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" \
+          ".,;:-_!$?*+#"
+    rpw = "".join(random.sample(pop, 32)) + pw + \
+        "".join(random.sample(pop, 32))
     return EncodeMarker + base64.b64encode(rpw.encode("utf-8")).decode("ascii")
 
 
@@ -77,8 +79,10 @@
                     MasterPassword = pwEncode(pw)
                 else:
                     E5MessageBox.warning(None,
-                        QCoreApplication.translate("Crypto", "Master Password"),
-                        QCoreApplication.translate("Crypto",
+                        QCoreApplication.translate(
+                            "Crypto", "Master Password"),
+                        QCoreApplication.translate(
+                            "Crypto",
                             """The given password is incorrect."""))
             else:
                 E5MessageBox.critical(None,
@@ -254,7 +258,8 @@
     
     @param data data to encrypt (bytes)
     @param password password to be used for encryption (string)
-    @keyparam keyLength length of the key to be generated for encryption (16, 24 or 32)
+    @keyparam keyLength length of the key to be generated for encryption
+        (16, 24 or 32)
     @keyparam hashIterations number of hashes to be applied to the password for
         generating the encryption key (integer)
     @return encrypted data (bytes) and flag indicating
@@ -284,7 +289,8 @@
     
     @param edata hashed data to decrypt (string)
     @param password password to be used for decryption (string)
-    @keyparam keyLength length of the key to be generated for decryption (16, 24 or 32)
+    @keyparam keyLength length of the key to be generated for decryption
+        (16, 24 or 32)
     @return decrypted data (bytes) and flag indicating
         success (boolean)
     """

eric ide

mercurial