分享

Qt如何进行MD5加密

 GLL_ 2019-02-20

创建一个简单的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 

版权声明:本文为博主原创文章,转载请附上博文链接!

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多