added tips to lamer.bash help
[mirrors/Programs.git] / php / skripty / char_case_brute.php
1 <?php
2
3 //die(urldecode("http://www.aliveband.se/L%e5tar/07-HARD%20DAYS%20NIGHT.mp3"));
4
5 $str = "Lo";
6
7
8 ///CODE//////////////////
9 function str2lower($str) {
10 return strtolower($str);
11 }
12 function str2upper($str) {
13 return strtoupper($str);
14 }
15
16 function fill_notset($str, $len, $char) {
17 $strout = $str;
18 $start = strlen($strout);
19 for($i=$start;$i<$len;$i++) {
20 $strout[$i] = $char;
21 }
22 return($strout);
23 }
24 //echo(fill_notset("aa", 5, "b")); die();
25 /////////////////////////
26 $origstr = $str = str2lower($str);
27 $len = strlen($str);
28 $origlen = $len;
29
30 $mask = "";
31 for (;$len > 0;$len--) {
32 $mask = $mask."1";
33 } //echo($mask);
34
35 $i = base_convert($mask, 2, 10); //echo($i);
36 while(1) {
37 $mask = base_convert($i, 10, 2);
38 $mask = fill_notset($mask, $len, "b");
39 if(strlen($mask) > strlen($str) || $i < 0) { die(); }
40
41 //Regular
42 $str = $origstr;
43 for ($len = $origlen-1;$len>=0;$len--) {
44 if(isset($mask[$len]) && $mask[$len] == "1") {
45 $str[$len] = str2upper($str[$len]);
46 }
47 } echo($mask);
48 echo("$str\n");
49
50 /*/Reversed
51 $mask = str_replace(array("0","1"), array("1","0"), $mask);
52 $str = $origstr;
53 for ($len = $origlen-1;$len>=0;$len--) {
54 if(isset($mask[$len]) && $mask[$len] == "1") {
55 $str[$len] = str2upper($str[$len]);
56 }
57 } //echo($mask);
58 echo("$str\n");
59 */
60
61 $i--;
62 }
This page took 1.211593 seconds and 4 git commands to generate.