是的,您的步骤似乎是正确的。攻击者散列大量单词或字符序列,直到找到与目标散列匹配的单词。
伪代码:
hashlist = [ "a235b8320c...", "688b4302c57f3...", ... ]
wordlist = file.readlines("/path/to/wordlist")
for each word in wordlist:
h = hash(word)
# is the hash of this word in the list of target hashes?
if h in hashlist:
print "Found: " + h + " = " + word
按照 muchaho 的要求,这里有一些伪代码说明它如何使用独特的盐:
hashlist = [ "salt1:a235b8320c...", "salt2:688b4302c57f3...", ... ]
wordlist = file.readlines("/path/to/wordlist")
for each h in hashlist:
salt = split(h, ':')[0]
h = split(h, ':')[1]
for each word in wordlist:
if hash(salt + word) == h:
print "Found: " + salt + ":" + hash + " = " + word
请注意,在为每个散列添加唯一盐之后,我们必须为每个目标散列尝试每个单独的候选词,而不是仅仅散列所有单词并等待一个匹配散列。当您有多个哈希要破解时,这会增加暴力破解成本,但最重要的是可以防止预计算攻击,例如彩虹表。