]> git.phdru.name Git - m_lib.git/blobdiff - m_lib/mcrypt.py
Use int() instead of atoi() for Py3 compatibility
[m_lib.git] / m_lib / mcrypt.py
index 76922a0efe71b521642e84d18055cce890cd7055..13357371147af122e0f08d1880ff6295a95318b0 100755 (executable)
@@ -26,6 +26,11 @@ def gen_salt():
 
 
 def test():
+   try:
+      raw_input
+   except NameError:  # Python 3
+      raw_input = input
+
    passwd = raw_input("Enter password: ")
    salt = gen_salt()
    encrypted = crypt.crypt(passwd, salt)
@@ -35,9 +40,8 @@ def test():
    pwd_file.close()
    print("Password file written")
 
-   import string
    pwd_file = open("test.pwd", 'r')
-   username, encrypted = string.split(pwd_file.readline()[:-1], ':')
+   username, encrypted = pwd_file.readline()[:-1].split(':')
    pwd_file.close()
 
    if crypt.crypt(encrypted, encrypted):