📄 md4_8cpp-source.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++: md4.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 Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Compound Members</a> | <a class="qindex" href="globals.html">File Members</a></div><h1>md4.cpp</h1><div class="fragment"><pre>00001 <span class="comment">// md4.cpp - modified by Wei Dai from Andrew M. Kuchling's md4.c</span>00002 <span class="comment">// The original code and all modifications are in the public domain.</span>00003 00004 <span class="comment">// This is the original introductory comment:</span>00005 00006 <span class="comment">/*</span>00007 <span class="comment"> * md4.c : MD4 hash algorithm.</span>00008 <span class="comment"> *</span>00009 <span class="comment"> * Part of the Python Cryptography Toolkit, version 1.1</span>00010 <span class="comment"> *</span>00011 <span class="comment"> * Distribute and use freely; there are no restrictions on further </span>00012 <span class="comment"> * dissemination and usage except those imposed by the laws of your </span>00013 <span class="comment"> * country of residence.</span>00014 <span class="comment"> *</span>00015 <span class="comment"> */</span>00016 00017 <span class="preprocessor">#include "pch.h"</span>00018 <span class="preprocessor">#include "md4.h"</span>00019 <span class="preprocessor">#include "misc.h"</span>00020 00021 NAMESPACE_BEGIN(CryptoPP)00022 00023 <span class="keywordtype">void</span> MD4::Init()00024 {00025 m_digest[0] = 0x67452301L;00026 m_digest[1] = 0xefcdab89L;00027 m_digest[2] = 0x98badcfeL;00028 m_digest[3] = 0x10325476L;00029 }00030 00031 <span class="keywordtype">void</span> MD4::Transform (word32 *digest, <span class="keyword">const</span> word32 *in)00032 {00033 <span class="comment">// #define F(x, y, z) (((x) & (y)) | ((~x) & (z)))</span>00034 <span class="preprocessor">#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))</span>00035 <span class="preprocessor"></span><span class="preprocessor">#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))</span>00036 <span class="preprocessor"></span><span class="preprocessor">#define H(x, y, z) ((x) ^ (y) ^ (z))</span>00037 <span class="preprocessor"></span>00038 word32 A, B, C, D;00039 00040 A=digest[0];00041 B=digest[1];00042 C=digest[2];00043 D=digest[3];00044 00045 <span class="preprocessor">#define function(a,b,c,d,k,s) a=rotlFixed(a+F(b,c,d)+in[k],s); </span>00046 <span class="preprocessor"></span> function(A,B,C,D, 0, 3);00047 function(D,A,B,C, 1, 7);00048 function(C,D,A,B, 2,11);00049 function(B,C,D,A, 3,19);00050 function(A,B,C,D, 4, 3);00051 function(D,A,B,C, 5, 7);00052 function(C,D,A,B, 6,11);00053 function(B,C,D,A, 7,19);00054 function(A,B,C,D, 8, 3);00055 function(D,A,B,C, 9, 7);00056 function(C,D,A,B,10,11);00057 function(B,C,D,A,11,19);00058 function(A,B,C,D,12, 3);00059 function(D,A,B,C,13, 7);00060 function(C,D,A,B,14,11);00061 function(B,C,D,A,15,19);00062 00063 <span class="preprocessor">#undef function </span>00064 <span class="preprocessor"></span><span class="preprocessor">#define function(a,b,c,d,k,s) a=rotlFixed(a+G(b,c,d)+in[k]+0x5a827999,s); </span>00065 <span class="preprocessor"></span> function(A,B,C,D, 0, 3);00066 function(D,A,B,C, 4, 5);00067 function(C,D,A,B, 8, 9);00068 function(B,C,D,A,12,13);00069 function(A,B,C,D, 1, 3);00070 function(D,A,B,C, 5, 5);00071 function(C,D,A,B, 9, 9);00072 function(B,C,D,A,13,13);00073 function(A,B,C,D, 2, 3);00074 function(D,A,B,C, 6, 5);00075 function(C,D,A,B,10, 9);00076 function(B,C,D,A,14,13);00077 function(A,B,C,D, 3, 3);00078 function(D,A,B,C, 7, 5);00079 function(C,D,A,B,11, 9);00080 function(B,C,D,A,15,13);00081 00082 <span class="preprocessor">#undef function </span>00083 <span class="preprocessor"></span><span class="preprocessor">#define function(a,b,c,d,k,s) a=rotlFixed(a+H(b,c,d)+in[k]+0x6ed9eba1,s); </span>00084 <span class="preprocessor"></span> function(A,B,C,D, 0, 3);00085 function(D,A,B,C, 8, 9);00086 function(C,D,A,B, 4,11);00087 function(B,C,D,A,12,15);00088 function(A,B,C,D, 2, 3);00089 function(D,A,B,C,10, 9);00090 function(C,D,A,B, 6,11);00091 function(B,C,D,A,14,15);00092 function(A,B,C,D, 1, 3);00093 function(D,A,B,C, 9, 9);00094 function(C,D,A,B, 5,11);00095 function(B,C,D,A,13,15);00096 function(A,B,C,D, 3, 3);00097 function(D,A,B,C,11, 9);00098 function(C,D,A,B, 7,11);00099 function(B,C,D,A,15,15);00100 00101 digest[0]+=A;00102 digest[1]+=B;00103 digest[2]+=C;00104 digest[3]+=D;00105 }00106 00107 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 + -