PDA

View Full Version : got bored last night


EscapeCharacter
06-08-2002, 09:36 AM
so i wrote a password generator for a friend of mine. nothing special but it works, only makes 8 character passwords so its kinda limited.


#include <iostream>
#include <fstream>
using namespace std;

void generate(char*);
void fix(char*, int);
char chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

int main(){
char pass[] = "AAAAAAAA";

generate(pass);
return 0;
}

void generate(char *pass){
int i;
ofstream s("password.txt", ios::out);
i = 0;
while(pass != "99999999"){
pass[7] = chars[i];
cout << i++ << "\t" << pass << endl;
s << pass << '\n';
if(pass[7] == chars[61]){
fix(pass, 0);
i = 0;
}
}
}

void fix(char *p, int count){
int c = count, j = 0;
char *pass = p;
if(pass[c+1] == chars[61]){
while(pass[c] != chars[j++]);
pass[c] = chars[j];
cout << "c == " << c << endl;
}
if(c < 8){
if(pass[c+1] == chars[61]){
pass[c+1] = chars[0];
}
c++;
fix(pass, c);
}
}

comrade
06-18-2002, 11:54 AM
I don't see any randomness

EscapeCharacter
06-18-2002, 07:35 PM
heh opps meant to say wordlist generator not password generator.

kmj
06-18-2002, 10:24 PM
heh :) I was wondering!