mos*_*osg 19 encryption qt qt4
在这里我得到了:
问题:如何简单地加密和加密简单的QString值?我需要这个能够将一些加密的字符串保存到INI文件中,并在重新打开应用程序后加密字符串到正常的密码字符串值.
PS:我看起来很简单,很好的解决方案.
感谢帮助!
Gan*_*alf 16
这里有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
#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();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27059 次 |
| 最近记录: |