创建一个简单的QT程序,在main.c文件中 添加头文件 #include <QCryptographicHash> //md5加密的库 #include <QDebug> //调试输出 #include "widget.h" #include <QApplication> #include <QCryptographicHash> //md5加密的库 #include <QDebug> //调试输出 int main(int argc, char *argv[]) { QApplication a(argc, argv); QString MD5; QString passWd="12345"; QByteArray str; str = QCryptographicHash::hash(passWd.toLatin1(),QCryptographicHash::Md5); MD5.append(str.toHex()); qDebug() << MD5; return a.exec(); } 调试输出 Starting /home/tarena/qt/build-MD5-Desktop_Qt_5_4_1_GCC_64bit-Debug/MD5... "827ccb0eea8a706c4c34a16891f84e7b" "827ccb0eea8a706c4c34a16891f84e7b" 这就是“12345”通过md5加密后的32位数据 --------------------- 作者:嵌入式学吒 来源:CSDN 原文:https://blog.csdn.net/rong11417/article/details/87804471 版权声明:本文为博主原创文章,转载请附上博文链接! |
|