[rhinstaller/anaconda/pulls/421 master] Improve password salt creation (#1229474)

vpodzime installerbot-noreply at redhat.com
Fri Oct 23 06:13:44 UTC 2015


> @@ -807,3 +808,12 @@ def open_with_perm_test(self):
>                  os.umask(old_umask)
>          finally:
>              shutil.rmtree(test_dir)
> +
> +class EncryptPasswordTests(unittest.TestCase):
> +    def encrypt_password_test(self):
> +        """ Test the encrypt_password function"""
> +        for algo in ["$1$", "$5$", "$6$"]:
> +            enc_pw = iutil.encrypt_password("DocBrown", algo, 16)
> +            self.assertEqual(algo, enc_pw[:3])
> +            self.assertEqual(crypt.crypt("DocBrown", enc_pw), enc_pw)
> +            self.assertNotEqual(crypt.crypt("Einstein", enc_pw), enc_pw)

I saw that. What I meant above is that AFAICT we duplicate things that ``crypt.crypt()`` now can do for us. There's ``crypt.mksalt()`` and ``crypt.crypt()`` can generate the salt on it's own if we give it the hashing algorithm. The only missing thing seems to be the length of the salt, but I'm not sure if we really use that with any non-standard lengths.

-- 
To view this pull request on github, visit https://github.com/rhinstaller/anaconda/pull/421#discussion_r42835899


More information about the anaconda-patches mailing list