monit
+ Reply to Thread
Results 1 to 2 of 2

Thread: Dynamic Combinations Script

  1. #1
    Join Date
    Jan 2005
    Posts
    623

    Dynamic Combinations Script

    I want to throw this script out there to see if any of you can speed it up. I wrote it in PHP. The script is dynamic so that you can control the conditions under which it runs.

    What does the script do?
    Runs through every possible combination given a set of characters and the length of an unknown string.

    Example Run
    Set of Characters:
    abcdefghijklmnopqrstuvwxyz
    Length of string:
    * Characters

    [url=http://boninroad.com/test/combinations.php]Test Script - Print Screen[/url]
    Script runs slow here because it prints to the screen for every combination
    [url=http://boninroad.com/test/combinations2.php]Test Script - No Print Screen[/url]
    Actual Run Time

    I would like to see if any of you can rewrite or modify the script to speed things up. Here is the script:
    Code:
    <?
    //THIS WILL LATER BE USED AS AN INPUT VALUE BY USER
    $wordlength=*;
    //THIS WILL LATER BE USED AS AN INPUT VALUE BY USER
    $combinations=array('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');
    
    $combinations_length=count($combinations);
    $pointer=($wordlength-*);
    
    for($i=0;$i<$wordlength;$i++)
    	{
    	$custom_array[$i]=0;
    	}
    
    //  Start TIMER
    //  SCRIPT FOUND HERE: http://www.desilva.biz/php/timer.html
    //  -----------
    $stimer = explode( ' ', microtime() );
    $stimer = $stimer[*] + $stimer[0];
    ////////////////////////////////////////
    while($pointer>=0)
    	{
    	$pointer=($wordlength-*);
    	while($custom_array[$pointer]<$combinations_length)
    		{
    		$custom_array[$pointer]=(($custom_array[$pointer])+*);
    		}
    	$custom_array[$pointer]=0;
    	$pointer--;
    	if($custom_array[$pointer]==($combinations_length-*))
    		{
    		while($custom_array[$pointer]==($combinations_length-*))
    			{
    			$custom_array[$pointer]=0;
    			$pointer--;
    			}
    		}
    	$custom_array[$pointer]=(($custom_array[$pointer])+*);
    	}
    //  End TIMER
    //  ---------
    $etimer = explode( ' ', microtime() );
    $etimer = $etimer[*] + $etimer[0];
    printf( "It Took: <b>%f</b> seconds.", ($etimer-$stimer) );
    //  ---------
    
    ?>

    I did not write the timer for the script. This was added for timing purposes


    If you do not understand how the script works try learning [url=http://mathforum.org/dr.math/faq/faq.comb.perm.html]Permutations and Combinations[/url]
    Last edited by SyntaXmasteR; 10-17-2006 at 05:46 PM.
    [url=http://www.syntax******.info/tools/services.php]Speed Up Windows XP[/url]
    [url=http://www.syntax******.info/tools/ip.php]Get An Ip Address[/url]
    [url=http://www.syntax******.info/tools/base_converter.php]Base Converter[/url]
    --------------------------------
    [URL=http://www.boninroad.com/syntax******/]Old Site[/URL]
    [URL=http://www.syntax******.info]Comming Soon[/URL]

  2. #2
    Join Date
    Jan 2005
    Posts
    623
    I added an input function to the script:
    [url=http://boninroad.com/test/combinations*.php]Test Script - Input Added[/url]

    You can enter any "password" using the lowercase set of characters "a-z". It will output the time it takes for the script to find your password, the location of your password, and the number of combinations it ran through to find your password.
    Last edited by SyntaXmasteR; 10-18-2006 at 05:36 PM.
    [url=http://www.syntax******.info/tools/services.php]Speed Up Windows XP[/url]
    [url=http://www.syntax******.info/tools/ip.php]Get An Ip Address[/url]
    [url=http://www.syntax******.info/tools/base_converter.php]Base Converter[/url]
    --------------------------------
    [URL=http://www.boninroad.com/syntax******/]Old Site[/URL]
    [URL=http://www.syntax******.info]Comming Soon[/URL]

+ Reply to Thread

Similar Threads

  1. staic and dynamic issues
    By cnd in forum Proxies and Firewalls
    Replies: 2
    Last Post: 10-19-2012, 05:36 AM
  2. ardamax help dynamic ip :\
    By gilberto in forum Viruses and Trojans
    Replies: 0
    Last Post: 09-16-2008, 11:00 AM
  3. I NEED HELP! Dynamic IP...
    By Justus in forum Proxies and Firewalls
    Replies: 3
    Last Post: 02-04-2006, 02:11 PM

Posting Permissions

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