Пример #1
0
 def test_bcrypt():
     print("Testing Bcrypt...")
     r = botan2.rng()
     phash = botan2.bcrypt('testing', r)
     print("bcrypt returned %s (%d bytes)" % (hex_encode(phash), len(phash)))
     print("validating the hash produced: %r" % (botan2.check_bcrypt('testing', phash)))
     print("\n")
Пример #2
0
 def test_bcrypt():
     print("Testing Bcrypt...")
     r = botan2.rng()
     phash = botan2.bcrypt('testing', r)
     print("bcrypt returned %s (%d bytes)" % (hex_encode(phash), len(phash)))
     print("validating the hash produced: %r" % (botan2.check_bcrypt('testing', phash)))
     print("\n")
Пример #3
0
    def test_bcrypt(self):
        r = botan2.RandomNumberGenerator()
        phash = botan2.bcrypt('testing', r)
        self.assertTrue(isinstance(phash, str))
        self.assertTrue(phash.startswith("$2a$"))

        self.assertTrue(botan2.check_bcrypt('testing', phash))
        self.assertFalse(botan2.check_bcrypt('live fire', phash))

        self.assertTrue(botan2.check_bcrypt('test', '$2a$04$wjen1fAA.UW6UxthpKK.huyOoxvCR7ATRCVC4CBIEGVDOCtr8Oj1C'))
Пример #4
0
    def test_bcrypt(self):
        r = botan2.RandomNumberGenerator()
        phash = botan2.bcrypt('testing', r)
        self.assertTrue(isinstance(phash, str))
        self.assertTrue(phash.startswith("$2a$"))

        self.assertTrue(botan2.check_bcrypt('testing', phash))
        self.assertFalse(botan2.check_bcrypt('live fire', phash))

        self.assertTrue(botan2.check_bcrypt('test', '$2a$04$wjen1fAA.UW6UxthpKK.huyOoxvCR7ATRCVC4CBIEGVDOCtr8Oj1C'))
Пример #5
0
def tag(pwd):
    return botan.bcrypt(pwd, botan.RandomNumberGenerator(), 11)