I am trying to compare QString against char*, but I fail to do that:
void Register::checkKey()
{
QFile kFile
("license.key");
{
sd.setText("The registration key doesn't exist.\n");
sd.exec();
exit(0);
}
kFile.close();
char ser[22];
hdidnt(ser);
char *crypt = hash.toUtf8().data();
encrypt(crypt, "key");
MD5 md;
if (test
!= QString::fromUtf8(md.
digestString(md.
digestString(md.
digestString(crypt
))))) {
sdf.
setText(QString::fromUtf8(md.
digestString(md.
digestString(md.
digestString(crypt
)))) + "\n" \
+ test + "\n" \
+ QString::number(sizeof(test.
toUtf8())) + "\n" \
);
sdf.exec();
sd.setText("This product must have a valid key.\n");
sd.exec();
KeyDialog kDialog;
kDialog.
setKey(QString::fromUtf8(md.
digestString(crypt
)));
kDialog.exec();
exit(0);
}
}
void Register::checkKey()
{
QMessageBox sd;
QFile kFile("license.key");
if (!kFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
sd.setText("The registration key doesn't exist.\n");
sd.exec();
exit(0);
}
QTextStream key(&kFile);
QString test = key.readLine();
kFile.close();
QString hash = GetMacAddress();
char ser[22];
hdidnt(ser);
QByteArray Id(ser);
hash += QString::fromUtf8(Id);
char *crypt = hash.toUtf8().data();
encrypt(crypt, "key");
MD5 md;
if (test != QString::fromUtf8(md.digestString(md.digestString(md.digestString(crypt)))))
{
QMessageBox sdf;
sdf.setText(QString::fromUtf8(md.digestString(md.digestString(md.digestString(crypt)))) + "\n" \
+ test + "\n" \
+ QString::number(sizeof(test.toUtf8())) + "\n" \
);
sdf.exec();
sd.setText("This product must have a valid key.\n");
sd.exec();
KeyDialog kDialog;
kDialog.setKey(QString::fromUtf8(md.digestString(crypt)));
kDialog.exec();
exit(0);
}
}
To copy to clipboard, switch view to plain text mode
I tryied also to convert QString to char* then make the comparison but I fail too. Both QString test and md.digestString(md.digestString(md.digestString(cr ypt))) return some value but they unenable to compare.
Bookmarks