Results 1 to 10 of 10

Thread: Generate all possible string with

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    42

    Exclamation Generate all possible string with

    I want to generate all possible string (a-z, A-Z, 0-9), thus:

    a
    b
    ...
    z
    aa
    ab
    ...
    az
    aaa
    ...


    First Question:

    Does anyone know how to do this, and is there any way to generate this list faster, eg: using hash tables or anything? And if so could you possibly give an example.


    Second Question:

    This calculations could take weeks on a normal PC, so I want to build in an option to pause and resume at a later stage.
    I have the last word that was generated from the previous calculation (eg: "aabc", thus the next word will be "aabd"). I have the last word and I want the calculation to start at the last position, and not to calculate each time from the begining.

    Thank for any help.

  2. #2
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Generate all possible string with

    It would be really cool if anyone could do that really fast because it would make cracking passwords really convenient wouldn't it?

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Generate all possible string with

    That's an amazing request. If you are looking for a-z, 0-9, and A-Z, that alone is 62 alternatives for a single digit, and the number of alternatives is 62^N where N is the number of digits. Worse yet, since this is strings, they are always relativelys slow, so there won't be any particularly fast alternative (though it would be faster to use numbers, so an array of base-62 numbers could be faster). Even worse, you will relatively quickly exceed the amount of memory in the computer, regardless of what you are running, so you'd have to implement something much more difficult to swap pages around.

    However, since the most obvious use for the program is a password guesser, and pretty nearly other need can better be accomplished in other ways, perhaps you could explain what the ultimate objective actually is, as there is probably a better alternative.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    42

    Re: Generate all possible string with

    You're correct.

    I know this won't happen over night, it'll most likely to take weeks (or even more).
    I notice brute force rar crackers have the save type of algorithm

  5. #5
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Generate all possible string with

    Quote Originally Posted by goocreations View Post
    You're correct.

    I know this won't happen over night, it'll most likely to take weeks (or even more).
    I notice brute force rar crackers have the save type of algorithm
    So you are looking to crack passwords? In that case I'd check the terms of use agreement you signed up to when joining the forum.

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    42

    Re: Generate all possible string with

    No, it's actually a university practical in data structures and algorithm efficiency.

    We have to choose any "high cpu consuming" algorithm, rewrite an algorithm an say if/how we can increase the algorithm performance.

    I've noticed that if you try to crack a rar file (without any knowledge of the pass) it says something like 5 years left to crack. So I've decided to choose this algorithm and to look how it works.

  7. #7
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: Generate all possible string with

    He just want random password generator.

    Paul help him :]

  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Generate all possible string with

    How many letters would there be for that rar file that would give it 5 years of crack time? Knowing that would give you some idea of the speed per iteration. Your target wouldn't necessarily be to run the algorithm to completion, but to lower the cost per iteration.

    There is a problem with that. A brute force approach that just creates every variation of the string would simply overflow the memory, so the task would have to be broken up into 'pages', and the algorithm to perform that pagination would not necessarily be involved in the cost per iteration at the lowest level.

    For example, if you looked at just 4 digit strings, the problem would be manageable. Eight digit strings are every 4 digit string joined to every other four digit string. Unfortunately, that would be in the vicinity of 15 million squared, so it can't be held in memory directly.

    What I would be looking at is making up a base-62 number class. Every permutation would be represented by a single base-62 number, and you might be able to map the digits in that number to a single array with 62 elements. The problem is that you can't write out a base-62 number, so the number would have to be a class, probably one with a List(of Integer) to hold the individual digits. I could go on, but if I was to do this, I would be looking up designs for base-N numbers, because I would expect that the problem has been solved MANY times over.
    My usual boring signature: Nothing

  9. #9
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Generate all possible string with

    I should add that any such class needs to have the ability to add, or at least to increment itself. This would remove the memory cost of creating every permutation, but it would do nothing at all about the cost of running some incredibly high number of iterations. Actually, the iterations should be fairly quick, as each digit would be an index into the character array, so creating the string from the digits would be simple enough. The problem would be the massive number of iterations.
    My usual boring signature: Nothing

  10. #10

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    42

    Re: Generate all possible string with

    thanx shaggy hiker, now I know where to start (I hope so)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width