diff --git a/docs/changes.txt b/docs/changes.txt index 699671229..ae9c8d2b7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -26,6 +26,7 @@ - Fixed DEScrypt cracking in BF mode in case the hashlist contains more than 16 times the same salt - Fixed use of option --keyspace in combination with -m 2500 (WPA) - Fixed rule 'O' (RULE_OP_MANGLE_OMIT) in host mode in case the offset + length parameter equals the length of the input word +- Fixed duplicate detection for WPA handshakes with the same ESSID * changes v3.20 -> v3.30: diff --git a/src/hashes.c b/src/hashes.c index 2ac7dd325..eb4ff9ba0 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -63,19 +63,13 @@ int sort_by_salt (const void *v1, const void *v2) if (res2 != 0) return (res2); - u32 n; - - n = 16; - - while (n--) + for (int n = 0; n < 16; n++) { if (s1->salt_buf[n] > s2->salt_buf[n]) return 1; if (s1->salt_buf[n] < s2->salt_buf[n]) return -1; } - n = 8; - - while (n--) + for (int n = 0; n < 8; n++) { if (s1->salt_buf_pc[n] > s2->salt_buf_pc[n]) return 1; if (s1->salt_buf_pc[n] < s2->salt_buf_pc[n]) return -1; diff --git a/src/potfile.c b/src/potfile.c index 4394b6d63..45034e071 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -29,29 +29,12 @@ int sort_by_hash_t_salt (const void *v1, const void *v2) const salt_t *s1 = h1->salt; const salt_t *s2 = h2->salt; - // testphase: this should work - u32 n = 16; - - while (n--) + for (int n = 0; n < 16; n++) { - if (s1->salt_buf[n] > s2->salt_buf[n]) return ( 1); + if (s1->salt_buf[n] > s2->salt_buf[n]) return 1; if (s1->salt_buf[n] < s2->salt_buf[n]) return -1; } - /* original code, seems buggy since salt_len can be very big (had a case with 131 len) - also it thinks salt_buf[x] is a char but its a u32 so salt_len should be / 4 - if (s1->salt_len > s2->salt_len) return ( 1); - if (s1->salt_len < s2->salt_len) return -1; - - u32 n = s1->salt_len; - - while (n--) - { - if (s1->salt_buf[n] > s2->salt_buf[n]) return ( 1); - if (s1->salt_buf[n] < s2->salt_buf[n]) return -1; - } - */ - return 0; } @@ -64,12 +47,11 @@ int sort_by_hash_t_salt_hccap (const void *v1, const void *v2) const salt_t *s2 = h2->salt; // last 2: salt_buf[10] and salt_buf[11] contain the digest (skip them) + // 9 * 4 = 36 bytes (max length of ESSID) - u32 n = 9; // 9 * 4 = 36 bytes (max length of ESSID) - - while (n--) + for (int n = 0; n < 9; n++) { - if (s1->salt_buf[n] > s2->salt_buf[n]) return ( 1); + if (s1->salt_buf[n] > s2->salt_buf[n]) return 1; if (s1->salt_buf[n] < s2->salt_buf[n]) return -1; }