﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; md5</title>
	<atom:link href="https://www.softwareace.cn/?feed=rss2&#038;tag=md5" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>qt 获取 MD5</title>
		<link>https://www.softwareace.cn/?p=63</link>
		<comments>https://www.softwareace.cn/?p=63#comments</comments>
		<pubDate>Tue, 15 Jan 2013 10:14:23 +0000</pubDate>
		<dc:creator><![CDATA[littlesu]]></dc:creator>
				<category><![CDATA[开发经验]]></category>
		<category><![CDATA[md5]]></category>

		<guid isPermaLink="false">http://192.168.0.106/?p=63</guid>
		<description><![CDATA[[crayon-6a186f4ec847f491362499/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">QFile

QString Hashes::MD5(QFile *fileStream)
    {
        QString md5;

        QByteArray hashData = QCryptographicHash::hash(fileStream-&gt;readAll(), QCryptographicHash::Md5);
        md5.append(hashData.toHex());
        fileStream-&gt;close();

        return md5;
    }

1.
#include &lt;QtCore/QCoreApplication&gt;

#include &lt;QCryptographicHash&gt;

#include &lt;iostream&gt;

int main(int argc, char *argv[])

{

 QCoreApplication a(argc, argv);

 QString pwd="abcdef";

 QString md5;

 QByteArray ba,bb;

 QCryptographicHash md(QCryptographicHash::Md5);

 ba.append(pwd);

 md.addData(ba);

 bb = md.result();

 md5.append(bb.toHex());

 std::cout&lt;&lt;md5.toStdString()&lt;&lt;std::endl;

 return a.exec();

}

2.
#include &lt;QtCore/QCoreApplication&gt;

#include &lt;QCryptographicHash&gt;

#include &lt;iostream&gt;

int main(int argc, char *argv[])

{

    QCoreApplication a(argc, argv);

    QString md5;

    QString pwd="abcdef";

    QByteArray bb;

    bb = QCryptographicHash::hash(pwd.toAscii(),QCryptographicHash::Md5 );

    md5.append(bb.toHex());

    std::cout&lt;&lt;md5.toStdString()&lt;&lt;std::endl;

    return a.exec();

}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=63</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
