Skip to content

Commit b0eccf4

Browse files
committed
Dynamically determine what method to call based on the hash type specified by the user. Generate the hash for each pass and compare it to what the user supplied
1 parent 01b8b9d commit b0eccf4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cracker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def __search_space(charset, maxlength):
4343
def attack(self, charset, maxlength):
4444
combined_charset = ''.join(charset)
4545
for attempt in self.__search_space(combined_charset, maxlength):
46-
if self.__hash == attempt:
46+
algorithm = getattr(hashlib, self.__hash_type.lower())()
47+
algorithm.update(attempt)
48+
if self.__hash == algorithm.hexdigest():
4749
print("Match found! Password is {}".format(attempt))
4850
break
4951

0 commit comments

Comments
 (0)