Bem eu sou iniciante em programação, muito iniciante, estou no primeiro semestre de ADS. Tenho um programa para fazer. A ideia do programa é quebrar hashs. qui vai meu código.
package testemd5;
import br.com.senacrs.util.MD5;
public class TesteMD5 {
@SuppressWarnings("empty-statement")
public static void main(String[] args) {
char dictAll[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
'F', 'G', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'W', 'V', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '&', '*', '(', ')', '_', '-',
'+', '=', '[', ']', '{', '}', '?', '/', '|', '>', '<'};
String dicthash[] = {"60bb1f9914c26fb929b724398e5d2f66", "81dc9bdb52d04dc20036dbd8313ed055",
"e2fc714c4727ee9395f324cd2e7f331f", "a4ab812db5e84ec4280a2067a0e009a8", "2b8160cf839671250fc0dabac7cc1d4e",
"a9cec9eeae78b260c010bc84b79a2330", "813c9e77c864c7cfc8b2ad9472c1dde6", "31be29a3d43701323c50de65d71af097",
"0a76d8749da8f67c37b6a3678d45ce9a", "01499346f9267b51e35095365aed4f15", "f38fef4c0e4988792723c29a0bd3ca98",
"229ae56bf5c7e60a1d0db30b423e6af6", "4998654b7d255461cd5110d5dcbac05b", "6af5f30627d3823099c2541d0b9326fc",
"5c55036d0b9dadec219f65c9d8d420c1", "a284236e525bff59c8956266df0ac1ea", "ca4abb07a2e12b9008c49953db2d0c0d",
"153ddfb15ae1e37b7cf004b201c3e3fd", "9cda986cec137d423863c2f9fca7c543", "3c2effe3f1157e5038b1dd0687d15957",
"2f4278d6d27c99dc212f23093ae9ac8e", "864a77ce17937bf629637a939b69da64", "9b82b6de580184657e6d95c4cfb2f337",
"e68d3c6431bf1e25eced5d26c301f68d", "e9510081ac30ffa83f10b68cde1cac07", "ff434d71061293390990711649b9dfd9",
"9de37a0627c25684fdd519ca84073e34", "b73fdaa1fb7669da760b49600c45d9be", "8343f6af1f2313770bea1954bbf3b3c6",
"3a4d92a1200aad406ac50377c7d863aa"};
System.out.println("Seja Bem Vindo!");
char palavra2[] = new char[4];
long timeI = System.currentTimeMillis();
for (int f = 0; f < dictAll.length; f++) {
palavra2[3] = dictAll[f];
for (int b = 0; b < dictAll.length; b++) {
palavra2[2] = dictAll[b];
for (int j = 0; j < dictAll.length; j++) {
palavra2[0] = dictAll[j];
for (int i = 0; i < dictAll.length; i++) {
palavra2[1] = dictAll[i];
String hash = MD5.gerarMD5(String.valueOf(palavra2));
System.out.println("VALOR -> " + String.valueOf(palavra2));
System.out.println("HASH: " + hash);
for (int h = 0; h < dicthash.length; h++) {
if (hash.equalsIgnoreCase (h)) {
long total_quebra = ((System.currentTimeMillis() - timeI) / 1000);
System.out.println("SENHA QUEBRADA! EM: " + total_quebra + " segundos");
System.out.println("SENHA: " + String.valueOf(palavra2));
System.out.println("HASH: " + hash);
}
}
}
}
}
long timeF = System.currentTimeMillis();
long total = timeI - timeF;
System.out.println("Tempo Final: " + total);
}
}
O que acontece eu quero que o programa faça um laço de repetição, igualando todas as hashs do dicionario “dicthash” a variável hash. Mas como vcs podem ver há um erro aí.
Meu if não dá certo. Alguém pode me ajudar com isso?’
Desde já agradeço.
