diff --git a/hate_crack/main.py b/hate_crack/main.py index b2f9040..6242794 100755 --- a/hate_crack/main.py +++ b/hate_crack/main.py @@ -1411,9 +1411,7 @@ def hcatFingerprint( raise ValueError("expander_len must be an integer between 7 and 36") crackedBefore = lineCount(hcatHashFile + ".out") - crackedAfter = 0 - while crackedBefore != crackedAfter: - crackedBefore = lineCount(hcatHashFile + ".out") + while True: _write_delimited_field(f"{hcatHashFile}.out", f"{hcatHashFile}.working", 2) expander_bin = ( hcatExpanderBin if expander_len == 7 else f"expander{expander_len}.bin" @@ -1477,6 +1475,9 @@ def hcatFingerprint( hcatHybrid(hcatHashType, hcatHashFile, [f"{hcatHashFile}.expanded"]) crackedAfter = lineCount(hcatHashFile + ".out") + if crackedAfter == crackedBefore: + break + crackedBefore = crackedAfter hcatFingerprintCount = lineCount(hcatHashFile + ".out") - hcatHashCracked diff --git a/tests/test_fingerprint_expander_and_hybrid.py b/tests/test_fingerprint_expander_and_hybrid.py index e4700da..e1b2bd0 100644 --- a/tests/test_fingerprint_expander_and_hybrid.py +++ b/tests/test_fingerprint_expander_and_hybrid.py @@ -42,7 +42,8 @@ def test_hcatFingerprint_uses_selected_expander_and_calls_hybrid(monkeypatch, tm out_path.write_text("deadbeef:Accordbookkeeping2025!:x\n") # Make the loop run exactly one iteration. - counts = iter([1, 1, 1, 1]) + # Calls: before-loop(1), end-of-iteration(1) == before → break, post-loop(1). + counts = iter([1, 1, 1]) monkeypatch.setattr(hc_main, "lineCount", lambda _p: next(counts)) monkeypatch.setattr(hc_main, "hcatHashCracked", 0)