def try_all_algorithms(self):
""" Try every algorithm available on the computer using the 'algorithms_available' functions from hashlib
an example of this functions would be:
>>> print(hashlib.algorithms_available)
set(['SHA1', 'SHA224', 'SHA', 'SHA384', ...])
>>> HashCracker("9a8b1b7eee229046fc2701b228fc2aff", type=None).try_all_algorithms()
{..., 'dc1e4c61bea0e5390c140fb1299a68a0f31b7af51f90abbd058f09689a8bb823': ['1 endow', 'sha256'],
'362b004395a3f52d9a0132868bd180bd': ['17 fellowship', 'MD5'],
'03195f6b6fa8dc1951f4944aed8cc4582cd72321': ['lovingkindness', 'RIPEMD160'], ..."""
for alg in hashlib.algorithms_available:
for word in self.words:
data = hashlib.new(alg)
data.update(word.strip())
self.results[data.hexdigest()] = [word.strip(), alg]
LOGGER.info("Created %i hashes, verifying against given hash (%s)" % (len(self.results), self.hash))
if self.verify_hashes() is False:
LOGGER.fatal("Unable to verify hash: %s" % self.hash)
else:
return self.verify_hashes()
评论列表
文章目录