这是我得到的:
问题:我怎样才能简单地加密和简单地加密QString价值?我需要它能够将一些加密的字符串保存到 INI 文件中,并在重新打开应用程序后将字符串加密为正常的密码字符串值。
PS:我正在寻找简单而好的解决方案。
感谢帮助!
这里有 SimpleCrypt:https://wiki.qt.io/Simple_encryption_with_SimpleCrypt https://wiki.qt.io/Simple_encryption_with_SimpleCrypt顾名思义,作者说该类不提供强加密,但在我看来它相当不错。
您可以在此处下载一个工作示例:http://www.qtcentre.org/threads/45346-Encrypting-an-existing-sqlite-database-in-sqlcipher?p=206406#post206406 http://www.qtcentre.org/threads/45346-Encrypting-an-existing-sqlite-database-in-sqlcipher?p=206406#post206406
#include <QtGui>
#include "simplecrypt.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString FreeTrialStartDate ;
//Set The Encryption And Decryption Key
SimpleCrypt processSimpleCrypt(89473829);
QString FreeTrialStartsOn("22/11/2011");
//Encrypt
FreeTrialStartDate = processSimpleCrypt.encryptToString(FreeTrialStartsOn);
qDebug() << "Encrypted 22/11/2011 to" << FreeTrialStartDate;
//Decrypt
QString decrypt = processSimpleCrypt.decryptToString(FreeTrialStartDate);
qDebug() << "Decrypted 22/11/2011 to" << decrypt;
return a.exec();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)