Brute force password cracker | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Brute force password cracker

I wrote a program to crack a password using brute force. Any ideas how to make it more faster? Give them a view in my profile.

9th Nov 2016, 2:48 AM
Megatron
Megatron - avatar
8 Answers
+ 3
I do not know what's the problem. But I can view your codes Pink Lenonade. Any ways here's the code. at posting time my codes were 20 hrs before modified. So search in most recent codes. after adding comment time+20. #include <iostream> #include <string> /* only lowercase alphabetical passwords are shown by the program */ using namespace std; int main() { string password; string generatedPass; cin >> password; char digArray[]={'a'-1,'a','a','a','a','a','a','a','a','a'}; for(int m=0;password[m]!='\0';m++) { if((password[m]>=65 && password[m]<=(65+25)) || (password[m]>=97 && password[m]<=(97+25))); else { cout<<"\nEnter Alphabetical pwd"; return 1; } } while( password.compare(generatedPass) != 0 ) { digArray[0]++; for(int x=0;x<password.length();x++) { if(digArray[x]=='z'+1) { digArray[x] = 'a'; digArray[x + 1]++; } } generatedPass=digArray[password.length()-1]; for(int i=password.length()-2;i>=0; i--) generatedPass+=digArray[i]; } cout <<"Password is:\t"<<generatedPass << endl; cout<<"!!!!!PLEASE LIKE IT!!!!!!"; return 0; }
9th Nov 2016, 1:15 PM
Megatron
Megatron - avatar
+ 2
No, I have made the code public so its not private. Tap(click) on the image of my profile. View the codes section to see the codes. or search for them in code playground.
9th Nov 2016, 3:25 AM
Megatron
Megatron - avatar
+ 2
JAVASCRIPT CODE FOR BRUTE PASSWORD CRACK import java.util.Arrays; import java.util.Scanner; public class BruteForce { public static void main( String[] args ) { String password; Scanner user_input = new Scanner( System.in ); password = user_input.next( ); char[] charset = "abcdefghijklmnopqrstuvwxyz".toCharArray(); BruteForce bf = new BruteForce(charset, 1); String attempt = bf.toString(); while (true) { if (attempt.equals(password)) { System.out.println("Password Found: " + attempt); break; } attempt = bf.toString(); System.out.println("" + attempt); bf.increment(); } } private char[] cs; private char[] cg; public BruteForce(char[] characterSet, int guessLength) { cs = characterSet; cg = new char[guessLength]; Arrays.fill(cg, cs[0]); } public void increment() { int index = cg.length - 1; while (index >= 0) { if (cg[index] == cs[cs.length - 1]) { if (index == 0) { cg = new char[cg.length + 1]; Arrays.fill(cg, cs[0]); break; } else { cg[index] = cs[0]; index--; } } else { cg[index] = cs[Arrays.binarySearch(cs, cg[index]) + 1]; break; } } } @Override public String toString() { return String.valueOf(cg); } }
10th Nov 2016, 11:22 AM
Megatron
Megatron - avatar
+ 2
OK Now I think I have understood why there was confusion. Pink Lemonade You must be logging in through website of sololearn. So you cannot see my codes. But I use sololearn app So I can see your codes. You have 1 code for web(HTML,CSS,JS). Palindrome Checker. Check out my code to swap variables in one line in c++ Here is the web link.. https://code.sololearn.com/c4M157jtDaZ7/#cpp
10th Nov 2016, 11:24 AM
Megatron
Megatron - avatar
+ 2
https://code.sololearn.com/cALevZo2gJfJ/?ref=app
4th Dec 2020, 9:52 AM
Tejas Chichkar
Tejas Chichkar - avatar
+ 1
We actually cant see your code in your profile. That is a private item that only you can see. Try posting it somewhere else and sharing the link, I'd love to help!
9th Nov 2016, 3:08 AM
James Finlinson
James Finlinson - avatar
+ 1
Yea, can't see codes bro. Nothing on your profile and I've gone through 20 odd pages of playground stuff after searching "Brute Force Password Cracker" and found nothing, post a link, would be easier :D
9th Nov 2016, 1:00 PM
Pink Lemonade
+ 1
Maybe I'm looking in the wrong place?? On your profile I can only see your Name, Level, Exp, courses and achievements? any way, irrelevant, thanks for providing the code :)
9th Nov 2016, 3:17 PM
Pink Lemonade