evilkid
asked on
Editing on a Brute force program
hello,
i have looked for a brute force code and i found one a bit complicated for me ,
i want to edit so i can set the minimum start length
because in this program it always start from 1
here s the code
http://www.multiupload.com/RFA9NPVPZV
i have looked for a brute force code and i found one a bit complicated for me ,
i want to edit so i can set the minimum start length
because in this program it always start from 1
here s the code
http://www.multiupload.com/RFA9NPVPZV
You might want to clarify your intentions before the mods get here = )
ASKER
mmm whats wrong with brute forcing? :o its just for educational purposes...
Created By DarkNexis. Designed For Educational Purposes.Good joke...
looking at the code, I guess the author still have many "educational" things to learn yet with algorithmic and Delphi language.
It is programmed like in old style C.
That said, I could do a lot better and solve you issue, but not before some moderator says it is Ok.
I believe there is not much wrong putting here an algorithm that generate 10e10 words, this technique could not be applied successfully on anything of real value
ASKER
@epasquier
yep as u said it could not be applied successfully on anythings harmful ..
yep as u said it could not be applied successfully on anythings harmful ..
Hi !
To moderator (& evilkid) : I decided to do it, because I really think I can put the emphasize on some real Educational purpose here. I promise it will be full of techniques that can be useful and put to good use.
To Evilkid : you really should change your nickname, and try to refrain from posting what could look like newbie hacker questions, this is a serious website. And please do not put links to dubious download platforms, where one serious expert is just one click away to install an also dubious application to *improve* download. I for one didn't liked it much.
That said, it will take some time for me to prepare something good, and I have a family, so please wait at least until monday before closing this post if I don't reply quickly.
Here is what I will do :
- the application will effectively generate all possible combinations of words with a specified charset and min/max size, which is the purpose. But :
- it will do it with an easy to understand algorithm (and the one in the sample is far from that, lots of things I don't understand the usefulness)
- it will be as quick as possible, also because the main algorithm will be simple : in computer algorithmic, often simplest = quickest. This time again will be a proof
- yet it is a lengthy calculation, so I will implement a few techniques used by good Delphi practicers, that follows
* disabling of the memo drawing while calculation is in order
* estimation of the remaining time, maybe a progressbar
* possibility to cancel the calculation if wanted, and if that is the case the list will be drawn with the values calculated at this point
* evaluation BEFORE the process is started of the memory requirements, and user validation if too big (say over 100Mo)
* reporting after calculation : time, memory usage
* saving to a file
And of course, I will try my best to make all this as clean as it can with such a lovely language as Delphi, like proper code indentation : pairs of begin/end MUST be ALIGNED to be readable, not such thing as one can often see in Java crapy code with a { at the end of a long line, and the corresponding } 100 char columns before. I HATE that (and it is said to be a coding standard...), and it is especially distateful when applied to Pascal/Delphi
Stay tuned !
To moderator (& evilkid) : I decided to do it, because I really think I can put the emphasize on some real Educational purpose here. I promise it will be full of techniques that can be useful and put to good use.
To Evilkid : you really should change your nickname, and try to refrain from posting what could look like newbie hacker questions, this is a serious website. And please do not put links to dubious download platforms, where one serious expert is just one click away to install an also dubious application to *improve* download. I for one didn't liked it much.
That said, it will take some time for me to prepare something good, and I have a family, so please wait at least until monday before closing this post if I don't reply quickly.
Here is what I will do :
- the application will effectively generate all possible combinations of words with a specified charset and min/max size, which is the purpose. But :
- it will do it with an easy to understand algorithm (and the one in the sample is far from that, lots of things I don't understand the usefulness)
- it will be as quick as possible, also because the main algorithm will be simple : in computer algorithmic, often simplest = quickest. This time again will be a proof
- yet it is a lengthy calculation, so I will implement a few techniques used by good Delphi practicers, that follows
* disabling of the memo drawing while calculation is in order
* estimation of the remaining time, maybe a progressbar
* possibility to cancel the calculation if wanted, and if that is the case the list will be drawn with the values calculated at this point
* evaluation BEFORE the process is started of the memory requirements, and user validation if too big (say over 100Mo)
* reporting after calculation : time, memory usage
* saving to a file
And of course, I will try my best to make all this as clean as it can with such a lovely language as Delphi, like proper code indentation : pairs of begin/end MUST be ALIGNED to be readable, not such thing as one can often see in Java crapy code with a { at the end of a long line, and the corresponding } 100 char columns before. I HATE that (and it is said to be a coding standard...), and it is especially distateful when applied to Pascal/Delphi
Stay tuned !
@epasquier
I don't think this should be much more than showing evilkid where to change MAX_BRUTE and which scrollbar change will set the size variable. Beyond that, I think you'd be crossing the hacking/cracking line. Thanks for being cautious.
I don't think this should be much more than showing evilkid where to change MAX_BRUTE and which scrollbar change will set the size variable. Beyond that, I think you'd be crossing the hacking/cracking line. Thanks for being cautious.
I doubt, these code is for the nickname. I should not do the code if I am capable or not. There are lots of educational purpose codes, I think that's not an appropriate help.
Listening...
Listening...
> I don't think this should be much more than showing evilkid where to change MAX_BRUTE
> and which scrollbar change will set the size variable.
It's more complex than that, the idea is to start with a MIN Length.
By the way, the gain is not that great to start with a length >1, because the way those strings are constructed, the lower values MUST be computed anyway. But will notbe displayed and not consume memory
> and which scrollbar change will set the size variable.
It's more complex than that, the idea is to start with a MIN Length.
By the way, the gain is not that great to start with a length >1, because the way those strings are constructed, the lower values MUST be computed anyway. But will notbe displayed and not consume memory
ASKER
@epasquier
thanks for your precious offer , cant wait till your next reply .. it sounds like a very promising
And yea that algorithm seems very hard .. but its the only one i found for Delphi :s ..
thanks for your precious offer , cant wait till your next reply .. it sounds like a very promising
And yea that algorithm seems very hard .. but its the only one i found for Delphi :s ..
@evilkid
Since this is for educational purposes, what other algorithms (and their implementations) have you studied?
Since this is for educational purposes, what other algorithms (and their implementations) have you studied?
ASKER
@aikimark
Sorting , Permutation and some cryptography algorithms
Sorting , Permutation and some cryptography algorithms
Hi !
I have started working on this project, here is a good start.
It implements all the parameters, and the architecture of the application needed around a "long process" management. I believe that is enough for you to start learning quite a few things already.
I have not yet implemented the generation of the data, for 2 reasons :
a) I think it's best for you that you concentrate first on all the new things I added
b) you can clearly see that "long process" is a right term for this problem of yours, and seing the application progressbar with an empty loop is enough to get the feel of it. Same goes for the computed estimations of iterations needed and memory requirements if we would really generate the data.
One note : you will need to install the JEDI (JCL and JVCL) library to use this code.
http://sourceforge.net/projects/jvcl/files/
For a few reasons :
a) I had no choice but to NOT use the default progressBar, because of the stupid animation that goes with it under Vista/Seven. It takes too much time and have too much impact on the smoothness/correctness of the progress bar position.
b) you said you are here to learn, so learn that no *serious* Delphi programmer can live without that great, open-source library that is JEDI. And installing a component library is part of the mandatory knowledge any Delphi programmer should get ASAP. If you need help about installing it, please search for ExpertExchange DB or with google as it has been explained a lot already. Or post another question if you feel the need. But do not come in this thread for that
I will add later (say tomorrow or monday) the real compute of the data. In the meantime , if you have question about how/why I did this or that in the code, say it and I will answer, but only shortly. If something is too much out of your grasp so that I cannot explain in a few lines, then I tell you upfront that I will ask you to post another thread.
I hope you'll like learning all you can with this project, as it is a good one to demonstrate some advanced stuff.
BruteForce.zip
I have started working on this project, here is a good start.
It implements all the parameters, and the architecture of the application needed around a "long process" management. I believe that is enough for you to start learning quite a few things already.
I have not yet implemented the generation of the data, for 2 reasons :
a) I think it's best for you that you concentrate first on all the new things I added
b) you can clearly see that "long process" is a right term for this problem of yours, and seing the application progressbar with an empty loop is enough to get the feel of it. Same goes for the computed estimations of iterations needed and memory requirements if we would really generate the data.
One note : you will need to install the JEDI (JCL and JVCL) library to use this code.
http://sourceforge.net/projects/jvcl/files/
For a few reasons :
a) I had no choice but to NOT use the default progressBar, because of the stupid animation that goes with it under Vista/Seven. It takes too much time and have too much impact on the smoothness/correctness of the progress bar position.
b) you said you are here to learn, so learn that no *serious* Delphi programmer can live without that great, open-source library that is JEDI. And installing a component library is part of the mandatory knowledge any Delphi programmer should get ASAP. If you need help about installing it, please search for ExpertExchange DB or with google as it has been explained a lot already. Or post another question if you feel the need. But do not come in this thread for that
I will add later (say tomorrow or monday) the real compute of the data. In the meantime , if you have question about how/why I did this or that in the code, say it and I will answer, but only shortly. If something is too much out of your grasp so that I cannot explain in a few lines, then I tell you upfront that I will ask you to post another thread.
I hope you'll like learning all you can with this project, as it is a good one to demonstrate some advanced stuff.
BruteForce.zip
yes, those too, but they are not components, just (great) tools. So not necessary to compile any project
ASKER
@epasquier
...to be sincere i love the way you code .. i hope someday i get to your level
and done installing components , it looks pretty good too.
I read your code , but excuse me .. i have got to open the main.pas to see the full code?
or the BruteForce.res? or its just a resource ? (i dont know how to use *.res ...)
I know its not complete but i cant even see the "Export list" button in the source you gave me :)
thx..
...to be sincere i love the way you code .. i hope someday i get to your level
and done installing components , it looks pretty good too.
I read your code , but excuse me .. i have got to open the main.pas to see the full code?
or the BruteForce.res? or its just a resource ? (i dont know how to use *.res ...)
I know its not complete but i cant even see the "Export list" button in the source you gave me :)
thx..
Code is in Main.Pas
ExportList button is in the pnlStatResults , and the onClick code is the very bottom of the Main.Pas code, which is logical because it is the very last thing the user will do (I try to sort my code logically)
ExportList button is in the pnlStatResults , and the onClick code is the very bottom of the Main.Pas code, which is logical because it is the very last thing the user will do (I try to sort my code logically)
Here is the final version.
I added :
- the computation of solutions itself
- improved speed of listbox(factor = 42x compared to standard) !!
- improved memory usage (factor =2+ compared to default Unicode strings in Delphi >=2009)
- correct estimation of memory usage and time to compute
I'm sure with that small app, you'll have opportunity to learn real useful techniques. And what it means to pay attention to algorithmic, memory management, and some other *details*.
BruteForce.zip
I added :
- the computation of solutions itself
- improved speed of listbox(factor = 42x compared to standard) !!
- improved memory usage (factor =2+ compared to default Unicode strings in Delphi >=2009)
- correct estimation of memory usage and time to compute
I'm sure with that small app, you'll have opportunity to learn real useful techniques. And what it means to pay attention to algorithmic, memory management, and some other *details*.
BruteForce.zip
ASKER
..i guess u selected the same beta file ...
cuz there are no new changes...
cuz there are no new changes...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you so much for this program
i learned a lot from the first lines already
the BruteForce procedure seems a bit complicated for me ^^ but im trying to understand it
thx again :)
i learned a lot from the first lines already
the BruteForce procedure seems a bit complicated for me ^^ but im trying to understand it
thx again :)
In fact, 90% of the code is for the pre-compute estimations (memory size, iterations and time needed ) and progressbar.
All the producing code is in RunCalc, which is fairly simple.
All the producing code is in RunCalc, which is fairly simple.
Given the allowed characters, here is an idea of the number of combinations that are generated for a given number of characters:
This represents 62^digits values.
Digits Number of Combinations
2 3,844
3 238,328
4 14,776,336
5 916,132,832
6 56,800,235,584
7 3,521,614,606,208
This represents 62^digits values.
nobody said it was applicable with all the characters and with a good number of digits :o)
yet that was a good learning project, don't you think aikimark ?
yet that was a good learning project, don't you think aikimark ?
It might be. I'm still wary of this topic in the hands of the unscrupulous.
I'm not.
the actual algorithm to generate the words can be done by anybody, more or less effectively. hacking an application by automating the testing of those is like triple integral compared to addition
the actual algorithm to generate the words can be done by anybody, more or less effectively. hacking an application by automating the testing of those is like triple integral compared to addition
ASKER
@epasquier
yea i meant the whole BruteForce procedure
and yep its a great learning project thx u so much
but why u dont use "Application.ProcessMessag es;" ?
@aikimark
no wonder it didnt work with 8 Digits
8^62 = 218,340,105,584,896 O_O !
yea i meant the whole BruteForce procedure
and yep its a great learning project thx u so much
but why u dont use "Application.ProcessMessag
@aikimark
no wonder it didnt work with 8 Digits
8^62 = 218,340,105,584,896 O_O !
I do use ProcessMessages, it is in procedure IncIteration
ASKER
i thought u had to put it in every loop (long loops i guess)
generally, you would do it based on some regular interval. I frequently use the Mod function on the iteration variable, or use a low-cost timer data source.
ASKER
and what is "Mod function" :)
modulo division (remainder after division)
use of mod : same here, as you can see.
the idea is this : there is going to be a huge amount of iteration. So :
a) no way we can let the user without interaction the long time it takes
b) no way either we are going to check on each iteration all the events, and update of the progressbar, time spent and estimated finish time. Or we would end up doing almost only that and it would take ages.
so I calculate the square root of the nb of iteration, so each Sqrt(Count) iteration I will do the progress checkings and process of messages. And that will be done also about Sqrt(Count) times. So you see, perfect balance of responsiveness and efficiency
And how do I do such a checking of '1 over Sqrt(Count)' ? simply with MOD operator
a MOD b = 0 when a = N x b (N integer)
the idea is this : there is going to be a huge amount of iteration. So :
a) no way we can let the user without interaction the long time it takes
b) no way either we are going to check on each iteration all the events, and update of the progressbar, time spent and estimated finish time. Or we would end up doing almost only that and it would take ages.
so I calculate the square root of the nb of iteration, so each Sqrt(Count) iteration I will do the progress checkings and process of messages. And that will be done also about Sqrt(Count) times. So you see, perfect balance of responsiveness and efficiency
And how do I do such a checking of '1 over Sqrt(Count)' ? simply with MOD operator
a MOD b = 0 when a = N x b (N integer)
ASKER
ah ok ..
but why the program cant exceed more than 4 (max and min) when i select the lower case,upper case and numbers
i get "Range Check Error"
but why the program cant exceed more than 4 (max and min) when i select the lower case,upper case and numbers
i get "Range Check Error"
because (26+26+10)^5=916132832
While the iteration count calculation is made in 64 bits mode, there are still a lot of limitations due to 32bits (and Delphi cannot compile as 64bits app - yet).
and so, the memory overhead needed ONLY to reserve the array that will hold the results is above the 32 bits limit. Not counting the data itself. So SetLength(Results,ResCount ); fails miserably.
I'm sorry, I haven't made the app foolproof for all those extreme cases. But it is only logical that some times, playing with parameters, you'll encounter some strange behaviour. Because what you ask is not possible to achieve in *standard* 32 bits app
While the iteration count calculation is made in 64 bits mode, there are still a lot of limitations due to 32bits (and Delphi cannot compile as 64bits app - yet).
and so, the memory overhead needed ONLY to reserve the array that will hold the results is above the 32 bits limit. Not counting the data itself. So SetLength(Results,ResCount
I'm sorry, I haven't made the app foolproof for all those extreme cases. But it is only logical that some times, playing with parameters, you'll encounter some strange behaviour. Because what you ask is not possible to achieve in *standard* 32 bits app
@evilkid
Why not set the characters to 2 or 3?
Why not set the characters to 2 or 3?
ASKER
@epasquier
:) ok
thx for your help
@aikimark
i wanted to check the program limits
and why it has limits :)
:) ok
thx for your help
@aikimark
i wanted to check the program limits
and why it has limits :)