1、下载QT第三方AES库
https://github.com/bricke/Qt-AES
2、拷贝头文件
将aesni下的头文件添加到工程的头文件中
将AES库文件下的qaesencryption.cpp和qaesencryption.h文件分别添加到工程的源文件和头文件中
我将以上文件统一放到了工程文件中的Include文件夹内,方便管理调用
3、引用
#include <QNetworkReply>
#include <QNetworkInterface>
#include <QCryptographicHash>
#include <QFile>
#include <QProcess>
#include <QMessageBox>
#include "Includes/qaesencryption.h"
#include "Includes/aestest.h"
#include <QCryptographicHash>
4、定义变量
QString key = "********";//加密秘钥
QString strMacAddr = "";//本机MAC地址
5、获取MAC生成秘钥文件
void MainWindow::getMacToFile()
{
//获取本机MAC地址
QList<QNetworkInterface> nets = QNetworkInterface::al