I am trying to compare QString against char*, but I fail to do that:
Qt Code:
  1. void Register::checkKey()
  2. {
  3. QFile kFile("license.key");
  4. if (!kFile.open(QIODevice::ReadOnly | QIODevice::Text))
  5. {
  6. sd.setText("The registration key doesn't exist.\n");
  7. sd.exec();
  8. exit(0);
  9. }
  10.  
  11. QTextStream key(&kFile);
  12. QString test = key.readLine();
  13. kFile.close();
  14. QString hash = GetMacAddress();
  15. char ser[22];
  16. hdidnt(ser);
  17. QByteArray Id(ser);
  18. hash += QString::fromUtf8(Id);
  19. char *crypt = hash.toUtf8().data();
  20. encrypt(crypt, "key");
  21. MD5 md;
  22. if (test != QString::fromUtf8(md.digestString(md.digestString(md.digestString(crypt)))))
  23. {
  24. sdf.setText(QString::fromUtf8(md.digestString(md.digestString(md.digestString(crypt)))) + "\n" \
  25. + test + "\n" \
  26. + QString::number(sizeof(test.toUtf8())) + "\n" \
  27. );
  28. sdf.exec();
  29. sd.setText("This product must have a valid key.\n");
  30. sd.exec();
  31. KeyDialog kDialog;
  32. kDialog.setKey(QString::fromUtf8(md.digestString(crypt)));
  33. kDialog.exec();
  34. exit(0);
  35. }
  36.  
  37. }
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.