Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Brute {
- long numCombinazioni=0;
- public String start(char charSet[], String password,char tryPassword[],int coulums[]) {
- //Inizio Ricerca esaustiva
- while(true) {
- for(int c=0;c<=charSet.length-1;c++) {
- numCombinazioni++;
- tryPassword[tryPassword.length-1]=charSet[c];
- String p=new String(tryPassword);
- System.out.println(p);
- if(p.equals(password)) {
- System.out.println("Password : "+p+" numero combinazioni provate "+ numCombinazioni);
- return p;
- }
- }
- int i=password.length();
- for(int c=tryPassword.length-1;c>=0;c--){
- if(tryPassword[c]==charSet[charSet.length-1]) {
- i=c-1; tryPassword[c]=charSet[0];
- coulums[i]++; coulums[i+1]=0;
- tryPassword[c-1]=charSet[coulums[i]];
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement