예제 #1
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'))
예제 #2
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'))
예제 #3
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")
예제 #4
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")
예제 #5
0
def varify(pwd, hash):
    return botan.check_bcrypt(pwd, hash)