Nekobee
[mirrors/Programs.git] / c / combinator.c
CommitLineData
21c4e167
H
1//BruteForCer - A combination sequence generator
2//Harvie 2oo7
3/*
4 * I hope, that this can show you that BF is the most suxing idea.
5 * You can use GREP pipe, if you know part of password.
6 * Brutforcing is the only way to be the real hacker. (Please don't pwn me ;)
7 * More info? UTFS!
8 */
9
10#include <stdio.h>
11
12void inc(char *comb, int i, int maxno) {
13 if(comb[i]==-1) { comb[i]=0; return; }
14 comb[i]=(comb[i]+1)%maxno;
15 if(comb[i]==0) inc(comb, i+1, maxno);
16}
17
18int main() {
19 int i, j;
20 int minlen = 0;
21 int maxlen = 10; //Lenght of string
22 //char full = 0; //0=Alphabet, 1=All possibilities
23 //char alpha[] = "01";
24 char alpha[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 "; //Alphabet
25 int alphmax = sizeof(alpha)-1; //printf("%d\n", alphmax);
26
27 char comb[maxlen];
28 for(i=0;i<=maxlen;i++) {
29 comb[i] = -1;
30 if(i<minlen) comb[i] = 0;
31 }
32 while(comb[maxlen]==-1) {
33 for(i=maxlen-1;i>=0;i--) if(comb[i]!=-1) putchar(alpha[comb[i]]); putchar('\n');
34 inc(comb,0,alphmax);
35 }
36
37 return 0;
38}
This page took 0.348451 seconds and 4 git commands to generate.