Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C# password generator

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Sun Sep 06, 2009 8:16 am    Post subject: C# password generator Reply with quote

Hi, I'm writing a password generator for a friend.
It should produce a .txt file with password strings:

aaaaa
aaaab
aaaac
aaaad - z
aaaba etc.

it needs to generate password with length 6 till length 15, every possibility.

i've created the following code, but it isn't very fast and efficient i think.

Code:


public string keyList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";

TextWriter tw = new StreamWriter(storage); // storage is .txt file
string txt = "";

// 4 letter test
            foreach (char a in keyList)
            {
                foreach (char b in keyList)
                {
                    foreach (char c in keyList)
                    {
                        foreach (char d in keyList)
                        {
                            text = a.ToString() + b.ToString() + c.ToString() + d.ToString();
                            tw.WriteLine(text);
                        }
                    }
                }
            }
            //5 letter test
            foreach (char a in keyList)
            {
                foreach (char b in keyList)
                {
                    foreach (char c in keyList)
                    {
                        foreach (char d in keyList)
                        {
                            foreach (char e in keyList)
                            {
                                text = a.ToString() + b.ToString() + c.ToString() + d.ToString() + e.ToString();
                                tw.WriteLine(text);
                            }
                        }
                    }
                }
            }

tw.Close();



Anyone has a more efficient way of creating this .txt file?
C# or c++, doesn't really matter.[/code]
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Sep 06, 2009 8:52 am    Post subject: Reply with quote

When I used to mess around with Python, I found this source on uselesspython.com

Code:
# A routine to generate all possible strings from an alphabet.
# Author : Rohit Krishna Kumar
# Home Page: http://www.geocities.com/rohitkkumar

def brutef(l,depth):
    global MAXDEPTH
    if(depth==0):                       # String has been generated
        s=""
        for k in l:                     # Make the list into a string
            s+=k
        print s                         # Call your password cracking routine here ;)
    else:
        for i in range(ord('a'),ord('z')+1): # Alphabet is a-z
                       l[MAXDEPTH-depth]=chr(i)
                       brutef(l,depth-1)

MAXDEPTH=3                              # Length of the string. Increase this if needed
l=[]
for i in range(MAXDEPTH):
    l.append('')
   
brutef(l,MAXDEPTH)


It works fine for me, and I don't think it should be hard to recode it to C#/C++ and make it output in a text file instead of console.

An idea for your source code, would be to write all the strings into an array-kind-of variable, and when it's ended, then write it to a txt. That would increase speed I assume.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Sep 06, 2009 8:44 pm    Post subject: Reply with quote

easiest way: http://www.asciitable.com/

just generate random numbers between whatever range you want, bam, impossible password generated.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites