# 字典攻击 for word in dictionary: # WC3 h = hashlib.md5(hashlib.md5(word.encode()).hexdigest().encode() + b"zomgsalt").hexdigest() if h in wc3_hashes: found_wc3.append((len(word), word))
# WC4 — 每条 hash 的 salt 不同 for entry in wc4_raw: target_hash = entry[:-8] # 前 40 hex = SHA1 salt = entry[-8:] # 后 8 hex = 4 bytes salt t = hashlib.sha1(b"zomgsalt4" + word.encode() + bytes.fromhex(salt) + b"zomgsalt4").hexdigest() if t == target_hash: found_wc4.append((len(word), word))