Code: Alles auswählen
#include <QtGui>
#include "PwHGui.h"
#include "PwHCore.h"
#include <iostream>
double std_ops=0;
//time_t stamp = time(0);
void PwHGui::get_Pw(int limes, char* str)
{
unsigned short ln = strlen(str);
char *cstring = new char[ln];
unsigned short array[ln];
for(int i = 0; i < ln; i++)
array[i] = 0;
//while (time (0) <= stamp); // Aktuelle Sekunde fertig abwarten
while(/*time (0) <= stamp + 1*/1)
{
std_ops++;
for(int i = ln; i > 0; i--)
cstring[ln-i] = ret_char(array[i-1]);
//cout<<cstring<<endl;
//ui.currentPw->setText("hallo");
cPW = cstring;
if(strcmp(cstring, str) == 0) //funktion beenden wenn passwd übereinstimmt
{
cout<<"gefunden: "<<cstring<<endl;
delete [] cstring;
break;
}
int i = 0;
for(; array[i] == limes; ++i) //rücksetzen der ziffern
{
array[i] = 0;
}
++array[i];
}
}
PwHGui::PwHGui(QDialog *parent) : QDialog(parent)
{
az = true;
azAZ = false;
azAZ09 = false;
xtra = false;
ui = new Ui::PwH;
ui->setupUi(this);
connector();
}
void PwHGui::connector()
{
timer = new QTimer;
connect(timer, SIGNAL(timeout() ), this, SLOT(setLabel() ) );
timer->start(100);
connect(ui->spinBox_beg, SIGNAL(valueChanged(int) ), ui->spinBox_end, SLOT(setValue(int) ) );
connect(ui->pushButton_start, SIGNAL(pressed() ), this, SLOT(startPwGen() ) );
connect(ui->spinBox_beg, SIGNAL(valueChanged(int) ), this, SLOT(setPwLnBeg(int) ) );
connect(ui->spinBox_end, SIGNAL(valueChanged(int) ), this, SLOT(setPwLnEnd(int) ) );
}
void PwHGui::setPwLnBeg(int z)
{
pwLn_beg = z;
}
void PwHGui::setPwLnEnd(int z)
{
pwLn_end = z;
}
void PwHGui::setLabel()
{
ui->currentPw->setText(cPW);
timer->start(100);
}
void PwHGui::startPwGen()
{
int area;
if(az == true && azAZ == false && azAZ09 == false && xtra == false)
area = 25;
//...
std::cout<<"starte Generator: "<<std::endl;
get_Pw(area, "autobahn");
}