示例#1
0
    def test_password_ssha(self):
        from ptah.password import SSHAPasswordManager

        manager = SSHAPasswordManager()

        password = text_("right А", 'utf-8')
        encoded = manager.encode(password, salt=bytes_("",'utf-8'))

        self.assertEqual(
            encoded, bytes_('{ssha}BLTuxxVMXzouxtKVb7gLgNxzdAI=','ascii'))
        self.assertTrue(manager.check(encoded, password))
        self.assertFalse(manager.check(encoded, password + "wrong"))

        encoded = manager.encode(password)
        self.assertTrue(manager.check(encoded, password))
示例#2
0
    def test_password_ssha(self):
        from ptah.password import SSHAPasswordManager

        manager = SSHAPasswordManager()

        password = u"right \N{CYRILLIC CAPITAL LETTER A}"
        encoded = manager.encode(password, salt="")

        self.assertEqual(encoded, '{ssha}BLTuxxVMXzouxtKVb7gLgNxzdAI=')
        self.assertTrue(manager.check(encoded, password))
        self.assertFalse(manager.check(encoded, password + u"wrong"))

        encoded = manager.encode(password)
        self.assertTrue(manager.check(encoded, password))