Bonsoir j'ai trouvé un script et voulais voir comment il fonctionnait pour l'optimiser un peu sachant que je débute en Python, mais il ne fonctionne pas des que j'ai trop de mots dans mon dictionnaire il ne fait plus la corrélation si quelqu'un peut m'aiguiller ce ne serait pas de refus cela me permettrait de progresser.

Je vous fourni le code en question:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import hashlib, sys
m = hashlib.sha256()
hash = ""
hash_file = 'hash.txt'
wordlist = 'm.txt'
try:
    hashdocument = open(hash_file,"r")
except IOError:
    print ("Invalid file.")
    input()
    sys.exit()
else:
    hash = hashdocument.readline()
    hash = hash.replace("\n","")
 
try:
    wordlistfile = open(wordlist,"r")
except IOError:
    print ("Invalid file.")
    input()
    sys.exit()
else:
    pass
for line in wordlistfile:
    m = hashlib.sha256() #flush the bufer (thiscaused a massive problem when placed at the beginning of the script, because the buffer kept getting overwritten, thus comparing incorrect hashes)
    line = line.replace("\n","")
    m.update(line.encode(wordlistfile.encoding))
    word_hash = m.hexdigest()
 
if word_hash == hash:
    print ("Collision! the word corresponding to the given hash is", line,)
    input()
    sys.exit()
 
print ("the hash given does not correspond to any supplied word in the wordlist.")
input()
sys.exit()