Skip to content

Commit

Permalink
Dynamically determine what method to call based on the hash type spec…
Browse files Browse the repository at this point in the history
…ified by the user. Generate the hash for each pass and compare it to what the user supplied
  • Loading branch information
aaronjwood committed Feb 21, 2016
1 parent 01b8b9d commit b0eccf4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def __search_space(charset, maxlength):
def attack(self, charset, maxlength):
combined_charset = ''.join(charset)
for attempt in self.__search_space(combined_charset, maxlength):
if self.__hash == attempt:
algorithm = getattr(hashlib, self.__hash_type.lower())()
algorithm.update(attempt)
if self.__hash == algorithm.hexdigest():
print("Match found! Password is {}".format(attempt))
break

Expand Down

0 comments on commit b0eccf4

Please sign in to comment.