Exemple #1
0
 def check_bcryptor(secret, hash):
     secret = to_native_str(secret,
                            self.FuzzHashGenerator.password_encoding)
     if hash.startswith((IDENT_2B, IDENT_2Y)):
         hash = IDENT_2A + hash[4:]
     else:
         if hash.startswith(IDENT_2):
             hash = IDENT_2A + hash[3:]
             if secret:
                 secret = repeat_string(secret, 72)
     return Engine(False).hash_key(secret, hash) == hash
 def check_bcryptor(secret, hash):
     "bcryptor"
     secret = to_native_str(secret, self.fuzz_password_encoding)
     if hash.startswith(IDENT_2Y):
         hash = IDENT_2A + hash[4:]
     elif hash.startswith(IDENT_2):
         # bcryptor doesn't support $2$ hashes; but we can fake it
         # using the $2a$ algorithm, by repeating the password until
         # it's 72 chars in length.
         hash = IDENT_2A + hash[3:]
         if secret:
             secret = repeat_string(secret, 72)
     return Engine(False).hash_key(secret, hash) == hash
Exemple #3
0
 def check_bcryptor(secret, hash):
     result = Engine(False).hash_key(secret, hash)
     self.assertEqual(result, hash,
                      "bcryptor: hash_key(%r,%r):" % (secret, hash))