Documentation for c26eea874d

This commit is contained in:
realstealthninja
2025-05-19 11:38:33 +00:00
parent c7a9a42397
commit 14583a2f33
2829 changed files with 30266 additions and 21669 deletions

View File

@@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: hashing/md5.cpp Source File</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -60,7 +60,7 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -124,7 +124,8 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="headertitle"><div class="title">md5.cpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d5/d96/md5_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<a href="../../d5/d96/md5_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span><span class="preprocessor">#include &lt;algorithm&gt;</span> </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span><span class="preprocessor">#include &lt;array&gt;</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span><span class="preprocessor">#include &lt;cassert&gt;</span> </div>
@@ -133,7 +134,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="preprocessor">#include &lt;iostream&gt;</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="preprocessor">#include &lt;string&gt;</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="preprocessor">#include &lt;vector&gt;</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span></div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d6/d0c/namespacehashing.html">hashing</a> {</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="keyword">namespace </span>md5 {</div>
<div class="foldopen" id="foldopen00067" data-start="{" data-end="}">
@@ -141,6 +142,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">return</span> (n &lt;&lt; rotate) | (n &gt;&gt; (32 - rotate));</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span>}</div>
</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span></div>
<div class="foldopen" id="foldopen00077" data-start="{" data-end="}">
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#af8e96bde0183c4b0a7ff04668f11e446"> 77</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#af8e96bde0183c4b0a7ff04668f11e446">isBigEndian</a>() {</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">union </span>{</div>
@@ -151,6 +153,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordflow">return</span> bint.c[0] == 1;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span>}</div>
</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span></div>
<div class="foldopen" id="foldopen00090" data-start="{" data-end="}">
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#a694712c9665051ba52b686387b87a689"> 90</a></span>uint32_t <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a694712c9665051ba52b686387b87a689">toLittleEndian32</a>(uint32_t n) {</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="keywordflow">if</span> (!<a class="code hl_function" href="../../d5/d96/md5_8cpp.html#af8e96bde0183c4b0a7ff04668f11e446">isBigEndian</a>()) {</div>
@@ -161,6 +164,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordflow">return</span> n;</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span>}</div>
</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span></div>
<div class="foldopen" id="foldopen00103" data-start="{" data-end="}">
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#a6be48c1e6e742f9bd329f501d61dcaef"> 103</a></span>uint64_t <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a6be48c1e6e742f9bd329f501d61dcaef">toLittleEndian64</a>(uint64_t n) {</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">if</span> (!<a class="code hl_function" href="../../d5/d96/md5_8cpp.html#af8e96bde0183c4b0a7ff04668f11e446">isBigEndian</a>()) {</div>
@@ -178,6 +182,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordflow">return</span> n;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span>}</div>
</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span></div>
<div class="foldopen" id="foldopen00123" data-start="{" data-end="}">
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348"> 123</a></span>std::string <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">sig2hex</a>(<span class="keywordtype">void</span>* sig) {</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* hexChars = <span class="stringliteral">&quot;0123456789abcdef&quot;</span>;</div>
@@ -190,6 +195,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordflow">return</span> hex;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span>}</div>
</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span></div>
<div class="foldopen" id="foldopen00139" data-start="{" data-end="}">
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425"> 139</a></span><span class="keywordtype">void</span>* <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425">hash_bs</a>(<span class="keyword">const</span> <span class="keywordtype">void</span>* input_bs, uint64_t input_size) {</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <span class="keyword">auto</span>* input = <span class="keyword">static_cast&lt;</span><span class="keyword">const </span>uint8_t*<span class="keyword">&gt;</span>(input_bs);</div>
@@ -203,7 +209,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <span class="comment">// K is pseudo-random values used each round</span></div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="comment">// The values can be obtained by the following python code:</span></div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span></div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> std::array&lt;uint32_t, 64&gt; K = {</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> 3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426,</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134,</div>
@@ -326,6 +332,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span> <span class="keywordflow">return</span> sig;</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span>}</div>
</div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span></div>
<div class="foldopen" id="foldopen00288" data-start="{" data-end="}">
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb"> 288</a></span><span class="keywordtype">void</span>* <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hash</a>(<span class="keyword">const</span> std::string&amp; message) {</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425">hash_bs</a>(&amp;message[0], message.size());</div>
@@ -333,58 +340,58 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
</div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span>} <span class="comment">// namespace md5</span></div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span>} <span class="comment">// namespace hashing</span></div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> </div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span></div>
<div class="foldopen" id="foldopen00298" data-start="{" data-end="}">
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 298</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> <span class="comment">// Hashes empty string and stores signature</span></div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> <span class="keywordtype">void</span>* sig = hashing::md5::hash(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> <span class="keywordtype">void</span>* sig = <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a>(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hashing empty string&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span> <span class="comment">// Prints signature hex representation</span></div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> std::cout &lt;&lt; hashing::md5::sig2hex(sig) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> std::cout &lt;&lt; <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> <span class="comment">// Test with cassert whether sig is correct from the expected value</span></div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> assert(hashing::md5::sig2hex(sig).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> assert(<a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span> <span class="stringliteral">&quot;d41d8cd98f00b204e9800998ecf8427e&quot;</span>) == 0);</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno"> 307</span> </div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno"> 308</span> <span class="comment">// Hashes &quot;The quick brown fox jumps over the lazy dog&quot; and stores signature</span></div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno"> 309</span> <span class="keywordtype">void</span>* sig2 =</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span> hashing::md5::hash(<span class="stringliteral">&quot;The quick brown fox jumps over the lazy dog&quot;</span>);</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a>(<span class="stringliteral">&quot;The quick brown fox jumps over the lazy dog&quot;</span>);</div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno"> 311</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hashing The quick brown fox jumps over the lazy dog&quot;</span></div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno"> 312</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno"> 313</span> <span class="comment">// Prints signature hex representation</span></div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> std::cout &lt;&lt; hashing::md5::sig2hex(sig2) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> std::cout &lt;&lt; <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig2) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> <span class="comment">// Test with cassert whether sig is correct from the expected value</span></div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span> assert(hashing::md5::sig2hex(sig2).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span> assert(<a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig2).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"> 317</span> <span class="stringliteral">&quot;9e107d9d372bb6826bd81d3542a419d6&quot;</span>) == 0);</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno"> 318</span> </div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno"> 319</span> <span class="comment">// Hashes &quot;The quick brown fox jumps over the lazy dog.&quot; (notice the</span></div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno"> 320</span> <span class="comment">// additional period) and stores signature</span></div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno"> 321</span> <span class="keywordtype">void</span>* sig3 =</div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> hashing::md5::hash(<span class="stringliteral">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>);</div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a>(<span class="stringliteral">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>);</div>
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno"> 323</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hashing &quot;</span></div>
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> <span class="stringliteral">&quot;The quick brown fox jumps over the lazy dog.&quot;</span></div>
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno"> 325</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno"> 326</span> <span class="comment">// Prints signature hex representation</span></div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> std::cout &lt;&lt; hashing::md5::sig2hex(sig3) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> std::cout &lt;&lt; <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig3) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno"> 328</span> <span class="comment">// Test with cassert whether sig is correct from the expected value</span></div>
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno"> 329</span> assert(hashing::md5::sig2hex(sig3).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno"> 329</span> assert(<a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig3).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno"> 330</span> <span class="stringliteral">&quot;e4d909c290d0fb1ca068ffaddf22cbd0&quot;</span>) == 0);</div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno"> 331</span> </div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno"> 332</span> <span class="comment">// Hashes &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&quot;</span></div>
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno"> 333</span> <span class="comment">// and stores signature</span></div>
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno"> 334</span> <span class="keywordtype">void</span>* sig4 = hashing::md5::hash(</div>
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno"> 334</span> <span class="keywordtype">void</span>* sig4 = <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a>(</div>
<div class="line"><a id="l00335" name="l00335"></a><span class="lineno"> 335</span> <span class="stringliteral">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&quot;</span>);</div>
<div class="line"><a id="l00336" name="l00336"></a><span class="lineno"> 336</span> std::cout</div>
<div class="line"><a id="l00337" name="l00337"></a><span class="lineno"> 337</span> &lt;&lt; <span class="stringliteral">&quot;Hashing &quot;</span></div>
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno"> 338</span> <span class="stringliteral">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&quot;</span></div>
<div class="line"><a id="l00339" name="l00339"></a><span class="lineno"> 339</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00340" name="l00340"></a><span class="lineno"> 340</span> <span class="comment">// Prints signature hex representation</span></div>
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno"> 341</span> std::cout &lt;&lt; hashing::md5::sig2hex(sig4) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno"> 341</span> std::cout &lt;&lt; <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig4) &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno"> 342</span> <span class="comment">// Test with cassert whether sig is correct from the expected value</span></div>
<div class="line"><a id="l00343" name="l00343"></a><span class="lineno"> 343</span> assert(hashing::md5::sig2hex(sig4).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00343" name="l00343"></a><span class="lineno"> 343</span> assert(<a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig4).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
<div class="line"><a id="l00344" name="l00344"></a><span class="lineno"> 344</span> <span class="stringliteral">&quot;d174ab98d277d9f5a5611c2c9f419d9f&quot;</span>) == 0);</div>
<div class="line"><a id="l00345" name="l00345"></a><span class="lineno"> 345</span>}</div>
</div>
<div class="line"><a id="l00346" name="l00346"></a><span class="lineno"> 346</span> </div>
<div class="line"><a id="l00346" name="l00346"></a><span class="lineno"> 346</span></div>
<div class="foldopen" id="foldopen00352" data-start="{" data-end="}">
<div class="line"><a id="l00352" name="l00352"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#ac9e1a11f44135b890dd10a00e73b5661"> 352</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#ac9e1a11f44135b890dd10a00e73b5661">interactive</a>() {</div>
<div class="line"><a id="l00353" name="l00353"></a><span class="lineno"> 353</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
@@ -392,8 +399,8 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00355" name="l00355"></a><span class="lineno"> 355</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Enter a message to be hashed (Ctrl-C to exit): &quot;</span></div>
<div class="line"><a id="l00356" name="l00356"></a><span class="lineno"> 356</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00357" name="l00357"></a><span class="lineno"> 357</span> std::getline(std::cin, input);</div>
<div class="line"><a id="l00358" name="l00358"></a><span class="lineno"> 358</span> <span class="keywordtype">void</span>* sig = hashing::md5::hash(input);</div>
<div class="line"><a id="l00359" name="l00359"></a><span class="lineno"> 359</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hash is: &quot;</span> &lt;&lt; hashing::md5::sig2hex(sig) &lt;&lt; std::endl;</div>
<div class="line"><a id="l00358" name="l00358"></a><span class="lineno"> 358</span> <span class="keywordtype">void</span>* sig = <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a88705fab5f92adf3427b4cf76ff33edb">hashing::md5::hash</a>(input);</div>
<div class="line"><a id="l00359" name="l00359"></a><span class="lineno"> 359</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hash is: &quot;</span> &lt;&lt; <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aaee69c6136a841043f956de32116e348">hashing::md5::sig2hex</a>(sig) &lt;&lt; std::endl;</div>
<div class="line"><a id="l00360" name="l00360"></a><span class="lineno"> 360</span> </div>
<div class="line"><a id="l00361" name="l00361"></a><span class="lineno"> 361</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
<div class="line"><a id="l00362" name="l00362"></a><span class="lineno"> 362</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Want to enter another message? (y/n) &quot;</span>;</div>
@@ -407,7 +414,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div class="line"><a id="l00370" name="l00370"></a><span class="lineno"> 370</span> }</div>
<div class="line"><a id="l00371" name="l00371"></a><span class="lineno"> 371</span>}</div>
</div>
<div class="line"><a id="l00372" name="l00372"></a><span class="lineno"> 372</span> </div>
<div class="line"><a id="l00372" name="l00372"></a><span class="lineno"> 372</span></div>
<div class="foldopen" id="foldopen00377" data-start="{" data-end="}">
<div class="line"><a id="l00377" name="l00377"></a><span class="lineno"><a class="line" href="../../d5/d96/md5_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 377</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"><a id="l00378" name="l00378"></a><span class="lineno"> 378</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
@@ -436,7 +443,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp_source.html','../../'); initResizable(
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_ece9b94c107bbaa1dd68197a8c9983b9.html">hashing</a></li><li class="navelem"><a class="el" href="../../d5/d96/md5_8cpp.html">md5.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
</ul>
</div>
</body>