⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 md5_8cpp-source.html

📁 Crypto++是一个非常强大的密码学库,主要是功能全
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Crypto++: md5.cpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div><h1>md5.cpp</h1><div class="fragment"><pre>00001 <span class="comment">// md5.cpp - modified by Wei Dai from Colin Plumb's public domain md5.c</span>00002 <span class="comment">// any modifications are placed in the public domain</span>00003 00004 <span class="preprocessor">#include "pch.h"</span>00005 <span class="preprocessor">#include "md5.h"</span>00006 <span class="preprocessor">#include "misc.h"</span>00007 00008 NAMESPACE_BEGIN(CryptoPP)00009 00010 <span class="keywordtype">void</span> MD5_TestInstantiations()00011 {00012         <a class="code" href="class_m_d5.html">MD5</a> x;00013 }00014 00015 <span class="keywordtype">void</span> MD5::Init()00016 {00017         m_digest[0] = 0x67452301L;00018         m_digest[1] = 0xefcdab89L;00019         m_digest[2] = 0x98badcfeL;00020         m_digest[3] = 0x10325476L;00021 }00022 00023 <span class="keywordtype">void</span> MD5::Transform (word32 *digest, <span class="keyword">const</span> word32 *in)00024 {00025 <span class="comment">// #define F1(x, y, z) (x &amp; y | ~x &amp; z)</span>00026 <span class="preprocessor">#define F1(x, y, z) (z ^ (x &amp; (y ^ z)))</span>00027 <span class="preprocessor"></span><span class="preprocessor">#define F2(x, y, z) F1(z, x, y)</span>00028 <span class="preprocessor"></span><span class="preprocessor">#define F3(x, y, z) (x ^ y ^ z)</span>00029 <span class="preprocessor"></span><span class="preprocessor">#define F4(x, y, z) (y ^ (x | ~z))</span>00030 <span class="preprocessor"></span>00031 <span class="preprocessor">#define MD5STEP(f, w, x, y, z, data, s) \</span>00032 <span class="preprocessor">        w = rotlFixed(w + f(x, y, z) + data, s) + x</span>00033 <span class="preprocessor"></span>00034     word32 a, b, c, d;00035 00036         a=digest[0];00037         b=digest[1];00038         c=digest[2];00039         d=digest[3];00040 00041     MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);00042     MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);00043     MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);00044     MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);00045     MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);00046     MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);00047     MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);00048     MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);00049     MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);00050     MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);00051     MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);00052     MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);00053     MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);00054     MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);00055     MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);00056     MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);00057 00058     MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);00059     MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);00060     MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);00061     MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);00062     MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);00063     MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);00064     MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);00065     MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);00066     MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);00067     MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);00068     MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);00069     MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);00070     MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);00071     MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);00072     MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);00073     MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);00074 00075     MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);00076     MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);00077     MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);00078     MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);00079     MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);00080     MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);00081     MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);00082     MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);00083     MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);00084     MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);00085     MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);00086     MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);00087     MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);00088     MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);00089     MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);00090     MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);00091 00092     MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);00093     MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);00094     MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);00095     MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);00096     MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);00097     MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);00098     MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);00099     MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);00100     MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);00101     MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);00102     MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);00103     MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);00104     MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);00105     MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);00106     MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);00107     MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);00108 00109         digest[0]+=a;00110         digest[1]+=b;00111         digest[2]+=c;00112         digest[3]+=d;00113 }00114 00115 NAMESPACE_END</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Jul 8 23:34:19 2003 for Crypto++ by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.2 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -