Esempio n. 1
0
    def test_make_site_password(self):
        # reroll 0 times
        self.assertEqual("P4{tRc6X3q}5)bCw}su=",
                alg.make_site_password("a", "b", old=True))
        self.assertEqual("4D*y7}fP646v3rdWEMz6",
                alg.make_site_password("batterystapler", "sportsball", old=True))

        # reroll 1 time
        self.assertEqual("C}Kzk*)6(CbR}sM5PxuK",
                alg.make_site_password("a", "sportsball", old=True))

        # bcrypted input
        self.assertEqual("M9PC77h*GmdN@?(hfxcY",
                alg.make_site_password(
                    "$2b$13$X5A4.IjQghzyTGwc0wgRrecUMeNiIgapq6zxM07dr3UDDdHUYWLTC",
                    "xyz", old=True))
Esempio n. 2
0
def make_password(slug, old):
    """
    Turns the password + slug into a 20 character password.
    The password is_good_pass and is deterministic.
    """
    if not session_intermediate:
        raise Exception("Cannot make password without an intermediate pw.")
    return alg.make_site_password(session_intermediate, slug, old=old)
Esempio n. 3
0
def make_password(slug, old):
    """
    Turns the password + slug into a 20 character password.
    The password is_good_pass and is deterministic.
    """
    if not session_intermediate:
        raise Exception("Cannot make password without an intermediate pw.")
    return alg.make_site_password(session_intermediate, slug, old=old)
Esempio n. 4
0
    def test_make_site_password(self):
        # reroll 0 times
        self.assertEqual("P4{tRc6X3q}5)bCw}su=",
                         alg.make_site_password("a", "b", old=True))
        self.assertEqual(
            "4D*y7}fP646v3rdWEMz6",
            alg.make_site_password("batterystapler", "sportsball", old=True))

        # reroll 1 time
        self.assertEqual("C}Kzk*)6(CbR}sM5PxuK",
                         alg.make_site_password("a", "sportsball", old=True))

        # bcrypted input
        self.assertEqual(
            "M9PC77h*GmdN@?(hfxcY",
            alg.make_site_password(
                "$2b$13$X5A4.IjQghzyTGwc0wgRrecUMeNiIgapq6zxM07dr3UDDdHUYWLTC",
                "xyz",
                old=True))
Esempio n. 5
0
 def _test_site(self, rerolls, master, slug, result):
     """Test one site password, ignores the reroll parameter."""
     self.assertEqual(result,
             alg.make_site_password(master, slug, old=True))
Esempio n. 6
0
 def _test_site(self, rerolls, intermediate, slug, result):
     """Test one site password, ignores the reroll parameter."""
     self.assertEqual(result, alg.make_site_password(intermediate, slug, old=False))
Esempio n. 7
0
 def _test_site(self, rerolls, intermediate, slug, result):
     """Test one site password, ignores the reroll parameter."""
     self.assertEqual(result,
                      alg.make_site_password(intermediate, slug, old=False))
Esempio n. 8
0
 def _test_site(self, rerolls, master, slug, result):
     """Test one site password, ignores the reroll parameter."""
     self.assertEqual(result, alg.make_site_password(master, slug,
                                                     old=True))