| | |
Creating Bruteforce Program
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
probably something like below: count using normal integers but convert to base62 for display.
Warning: The above code is not ansi standard. Here is a link you might be able to use if you need something ansi standard.
[edit]I have done a little testing with the algorithms in the link I posted and none of them produce the same result as _itoa() function. The first algorithm for my_atoi() might be a fairly simple fix -- it just leaves off the last digit.[/edit]
C++ Syntax (Toggle Plain Text)
#include <cstring> #include <iostream> using namespace std; int main( ) { long n = 1234576; char buf[255]; _itoa( n, buf, 62 ); cout << buf << "\n"; return 0; }
Warning: The above code is not ansi standard. Here is a link you might be able to use if you need something ansi standard.
[edit]I have done a little testing with the algorithms in the link I posted and none of them produce the same result as _itoa() function. The first algorithm for my_atoi() might be a fairly simple fix -- it just leaves off the last digit.[/edit]
Last edited by Ancient Dragon; Jul 20th, 2006 at 6:53 pm.
Well here is a c++ version that should be portable and returns the same as itoa().
C++ Syntax (Toggle Plain Text)
string my_itoa(int value, int base) { string s; for(int i = base; value && i ; --i, value /= base) { s = "0123456789abcdefghijklmnopqrstuvwxyz"[value % base] + s; } return s; }
Last edited by Ancient Dragon; Jul 20th, 2006 at 8:48 pm.
•
•
Join Date: Nov 2009
Posts: 4
Reputation:
Solved Threads: 0
0
#5 Nov 14th, 2009
Here's my code, tested for errors:
it cracks the string h3ar7 in 16 seconds on my computer.
c++ Syntax (Toggle Plain Text)
#include <iostream> #include <string> using namespace std; char chars[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; string t; void checkPassword(string password); void recurse(int width, int position, string baseString); int main() { cout << "Enter a string: " << endl; cin >> t; int maxChars = 13; for(int i=0;i<maxChars+1;i++) { cout << "checking passwords width [" << i << "]..." << endl; recurse(i,0,""); } return 0; } void recurse(int width, int position, string baseString) { for(int i=0;i<35;i++) { if (position < width-1) { recurse(width, position + 1, baseString+chars[i]); } checkPassword(baseString+chars[i]); } } void checkPassword(string password) { if (password==t) { cout << "match [" << password << "]" << endl; exit(1); } }
![]() |
Similar Threads
- need help creating simple program (Python)
- Affiliates Program (Ad Space for Sale)
- C++: Clicking Locations on Screen (C++)
- Creating a program to run under various OS (Pascal and Delphi)
- Creating a locking program (C)
Other Threads in the C++ Forum
- Previous Thread: Structure Error?
- Next Thread: Kindly suggest me the algorithm
Views: 8501 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets







