I'm interested in creating a bruteforce program. What is the most computer resource efficient method to count in base 62? (1,2,3...a,b,c...A,B,C)
portege
0
Light Poster
Recommended Answers
Jump to Postprobably something like below: count using normal integers but convert to base62 for display.
#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 …
Jump to PostWell here is a c++ version that should be portable and returns the same as itoa().
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; …
Jump to Post>>it cracks the string h3ar7 in 16 seconds on my computer.
Thats pretty slow. There is no reason to use recursion here.
Jump to Posts = "0123456789abcdefghijklmnopqrstuvwxyz"[value % base] + s;
offtopic:I'm having trouble understanding this line, so you're initializing s with "01..yz"
but what does the[value % base] + s
part actually do?
Jump to PostWould it help if the code looked like this?
string digits = "0123456789abcdefghijklmnopqrstuvwxyz"; int index = value % base; s = digits[index] + s;
All 17 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
combustion
-1
Newbie Poster
William Hemsworth
commented:
3 years late.
-1
combustion
-1
Newbie Poster
burmix
0
Newbie Poster
mrnutty
761
Senior Poster
Shadowlala
0
Newbie Poster
Hereticbeast
0
Newbie Poster
CPT
0
Newbie Poster
Narue
5,707
Bad Cop
Team Colleague
CPT
0
Newbie Poster
Narue
5,707
Bad Cop
Team Colleague
raptr_dflo
48
Posting Pro
Hereticbeast
0
Newbie Poster
raptr_dflo
48
Posting Pro
Hereticbeast
0
Newbie Poster
raptr_dflo
48
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.