mirror of
https://github.com/ovosimpatico/quebrando-senhas.git
synced 2026-01-15 16:12:52 -03:00
More efficient word generation
This commit is contained in:
@@ -35,37 +35,17 @@ def senhas(senha_com_nome):
|
||||
return listadesenhas, listadenomes
|
||||
|
||||
def combinations():
|
||||
#Gera todas as combinações de palavras possíveis
|
||||
#com as palavras do arquivo "palavras.txt"
|
||||
# Generate all possible combinations of words from the "palavras.txt" file
|
||||
from rich.progress import track
|
||||
from src.generic import lista
|
||||
lista = lista()
|
||||
listafinal = []
|
||||
words = lista()
|
||||
combinations = []
|
||||
|
||||
lista1 = list(product(lista, repeat=1))
|
||||
lista2 = list(product(lista, repeat=2))
|
||||
lista3 = list(product(lista, repeat=3))
|
||||
lista4 = list(product(lista, repeat=4))
|
||||
lista5 = list(product(lista, repeat=5))
|
||||
listatotal = lista1 + lista2 + lista3 + lista4 + lista5
|
||||
for n in range(1, 6):
|
||||
for combo in track(product(words, repeat=n), f"Computing {n}-word combinations..."):
|
||||
combinations.append(" ".join(combo))
|
||||
|
||||
for i in track(range(len(listatotal)), "Computando as combinações..."):
|
||||
if len(listatotal[i]) == 1:
|
||||
listafinal.append(listatotal[i][0])
|
||||
|
||||
elif len(listatotal[i]) == 2:
|
||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1])
|
||||
|
||||
elif len(listatotal[i]) == 3:
|
||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1]+' '+listatotal[i][2])
|
||||
|
||||
elif len(listatotal[i]) == 4:
|
||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1]+' '+listatotal[i][2]+' '+listatotal[i][3])
|
||||
|
||||
elif len(listatotal[i]) == 5:
|
||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1]+' '+listatotal[i][2]+' '+listatotal[i][3]+' '+listatotal[i][4])
|
||||
|
||||
return listafinal
|
||||
return combinations
|
||||
|
||||
def criptografaCombinacoes(combinacoes):
|
||||
#Criptografa todas as combinações geradas
|
||||
|
||||
Reference in New Issue
Block a user