mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-12-01 00:36:26 +08:00
Documentation for 8b1eab204b
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
@@ -5,10 +6,15 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: hashing/sha1.cpp File Reference</title>
|
||||
<title>TheAlgorithms/C++: hashing/sha1.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../jquery.js"></script>
|
||||
<script type="text/javascript" src="../../dynsections.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
@@ -18,14 +24,24 @@
|
||||
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -126,7 +143,9 @@ Include dependency graph for sha1.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d3/d4c/sha1_8cpp__incl.svg" width="100%" height="383"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
</div>
|
||||
<p><a href="../../d8/d7a/sha1_8cpp_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/d0c/namespacehashing.html">hashing</a></td></tr>
|
||||
@@ -138,16 +157,16 @@ Namespaces</h2></td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:acf6bd970f29a68702bdbdfe8338e45e0" id="r_acf6bd970f29a68702bdbdfe8338e45e0"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="#acf6bd970f29a68702bdbdfe8338e45e0">hashing::sha1::leftRotate32bits</a> (uint32_t n, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> rotate)</td></tr>
|
||||
<tr class="memitem:acf6bd970f29a68702bdbdfe8338e45e0" id="r_acf6bd970f29a68702bdbdfe8338e45e0"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="#acf6bd970f29a68702bdbdfe8338e45e0">hashing::sha1::leftRotate32bits</a> (uint32_t n, std::size_t rotate)</td></tr>
|
||||
<tr class="memdesc:acf6bd970f29a68702bdbdfe8338e45e0"><td class="mdescLeft"> </td><td class="mdescRight">Rotates the bits of a 32-bit unsigned integer. <br /></td></tr>
|
||||
<tr class="separator:acf6bd970f29a68702bdbdfe8338e45e0"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aada0803ef851d831b7a290a924e3c228" id="r_aada0803ef851d831b7a290a924e3c228"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a> (void *sig)</td></tr>
|
||||
<tr class="memitem:aada0803ef851d831b7a290a924e3c228" id="r_aada0803ef851d831b7a290a924e3c228"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a> (void *sig)</td></tr>
|
||||
<tr class="memdesc:aada0803ef851d831b7a290a924e3c228"><td class="mdescLeft"> </td><td class="mdescRight">Transforms the 160-bit SHA-1 signature into a 40 char hex string. <br /></td></tr>
|
||||
<tr class="separator:aada0803ef851d831b7a290a924e3c228"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a7be3471f7e489d7d0df42b97a48bf141" id="r_a7be3471f7e489d7d0df42b97a48bf141"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a7be3471f7e489d7d0df42b97a48bf141">hashing::sha1::hash_bs</a> (const void *input_bs, uint64_t input_size)</td></tr>
|
||||
<tr class="memdesc:a7be3471f7e489d7d0df42b97a48bf141"><td class="mdescLeft"> </td><td class="mdescRight">The SHA-1 algorithm itself, taking in a bytestring. <br /></td></tr>
|
||||
<tr class="separator:a7be3471f7e489d7d0df42b97a48bf141"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a2397f2444a05e4d1487c67e215410d3c" id="r_a2397f2444a05e4d1487c67e215410d3c"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &message)</td></tr>
|
||||
<tr class="memitem:a2397f2444a05e4d1487c67e215410d3c" id="r_a2397f2444a05e4d1487c67e215410d3c"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a> (const std::string &message)</td></tr>
|
||||
<tr class="memdesc:a2397f2444a05e4d1487c67e215410d3c"><td class="mdescLeft"> </td><td class="mdescRight">Converts the string to bytestring and calls the main algorithm. <br /></td></tr>
|
||||
<tr class="separator:a2397f2444a05e4d1487c67e215410d3c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
||||
@@ -168,6 +187,8 @@ Functions</h2></td></tr>
|
||||
Algorithm</h3>
|
||||
<p>The first step of the algorithm is to pad the message for its length to be a multiple of 64 (bytes). This is done by first adding 0x80 (10000000) and then only zeroes until the last 8 bytes must be filled, where then the 64 bit size of the input will be added</p>
|
||||
<p>Once this is done, the algo breaks down this padded message into 64 bytes chunks. Each chunk is used for one <em>round</em>, a round breaks the chunk into 16 blocks of 4 bytes. These 16 blocks are then extended to 80 blocks using <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operations on existing blocks (see code for more details). The algorithm will then update its 160-bit state (here represented used 5 32-bits integer) using partial hashes computed using special functions on the blocks previously built. Please take a look at the <a href="https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode" target="_blank">wikipedia article</a> for more precision on these operations </p><dl class="section note"><dt>Note</dt><dd>This is a simple implementation for a byte string but some implmenetations can work on bytestream, messages of unknown length. </dd></dl>
|
||||
|
||||
<p class="definition">Definition in file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a2397f2444a05e4d1487c67e215410d3c" name="a2397f2444a05e4d1487c67e215410d3c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a2397f2444a05e4d1487c67e215410d3c">◆ </a></span>hash()</h2>
|
||||
@@ -178,7 +199,7 @@ Algorithm</h3>
|
||||
<tr>
|
||||
<td class="memname">void * hashing::sha1::hash </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &</td> <td class="paramname"><span class="paramname"><em>message</em></span></td><td>)</td>
|
||||
<td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>message</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -192,17 +213,13 @@ Algorithm</h3>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void* Pointer to the SHA-1 signature </dd></dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 211</span> {</div>
|
||||
<div class="line"><span class="lineno"> 212</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425">hash_bs</a>(&message[0], message.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">size</a>());</div>
|
||||
<div class="line"><span class="lineno"> 213</span>}</div>
|
||||
<div class="ttc" id="amd5_8cpp_html_a5341431cef7fcfc33794326e1deb2425"><div class="ttname"><a href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425">hashing::md5::hash_bs</a></div><div class="ttdeci">void * hash_bs(const void *input_bs, uint64_t input_size)</div><div class="ttdoc">The MD5 algorithm itself, taking in a bytestring.</div><div class="ttdef"><b>Definition</b> md5.cpp:139</div></div>
|
||||
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">std::string::size</a></div><div class="ttdeci">T size(T... args)</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d7a/sha1_8cpp_a2397f2444a05e4d1487c67e215410d3c_cgraph.svg" width="308" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00211">211</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 211</span> {</div>
|
||||
<div class="line"><span class="lineno"> 212</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425">hash_bs</a>(&message[0], message.size());</div>
|
||||
<div class="line"><span class="lineno"> 213</span>}</div>
|
||||
<div class="ttc" id="amd5_8cpp_html_a5341431cef7fcfc33794326e1deb2425"><div class="ttname"><a href="../../d5/d96/md5_8cpp.html#a5341431cef7fcfc33794326e1deb2425">hashing::md5::hash_bs</a></div><div class="ttdeci">void * hash_bs(const void *input_bs, uint64_t input_size)</div><div class="ttdoc">The MD5 algorithm itself, taking in a bytestring.</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d96/md5_8cpp_source.html#l00139">md5.cpp:139</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a7be3471f7e489d7d0df42b97a48bf141" name="a7be3471f7e489d7d0df42b97a48bf141"></a>
|
||||
@@ -233,6 +250,8 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void* Pointer to the 160-bit signature </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00084">84</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 84</span> {</div>
|
||||
<div class="line"><span class="lineno"> 85</span> <span class="keyword">auto</span>* input = <span class="keyword">static_cast<</span><span class="keyword">const </span>uint8_t*<span class="keyword">></span>(input_bs);</div>
|
||||
<div class="line"><span class="lineno"> 86</span> </div>
|
||||
@@ -254,10 +273,10 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 102</span> }</div>
|
||||
<div class="line"><span class="lineno"> 103</span> </div>
|
||||
<div class="line"><span class="lineno"> 104</span> <span class="comment">// Allocate the memory for the padded message</span></div>
|
||||
<div class="line"><span class="lineno"> 105</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<uint8_t></a> padded_message(padded_message_size);</div>
|
||||
<div class="line"><span class="lineno"> 105</span> std::vector<uint8_t> padded_message(padded_message_size);</div>
|
||||
<div class="line"><span class="lineno"> 106</span> </div>
|
||||
<div class="line"><span class="lineno"> 107</span> <span class="comment">// Beginning of the padded message is the original message</span></div>
|
||||
<div class="line"><span class="lineno"> 108</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a>(input, input + input_size, padded_message.begin());</div>
|
||||
<div class="line"><span class="lineno"> 108</span> std::copy(input, input + input_size, padded_message.begin());</div>
|
||||
<div class="line"><span class="lineno"> 109</span> </div>
|
||||
<div class="line"><span class="lineno"> 110</span> <span class="comment">// Afterwards comes a single 1 bit and then only zeroes</span></div>
|
||||
<div class="line"><span class="lineno"> 111</span> padded_message[input_size] = 1 << 7; <span class="comment">// 10000000</span></div>
|
||||
@@ -277,7 +296,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 125</span> }</div>
|
||||
<div class="line"><span class="lineno"> 126</span> </div>
|
||||
<div class="line"><span class="lineno"> 127</span> <span class="comment">// Already allocate memory for blocks</span></div>
|
||||
<div class="line"><span class="lineno"> 128</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<uint32_t, 80></a> blocks{};</div>
|
||||
<div class="line"><span class="lineno"> 128</span> std::array<uint32_t, 80> blocks{};</div>
|
||||
<div class="line"><span class="lineno"> 129</span> </div>
|
||||
<div class="line"><span class="lineno"> 130</span> <span class="comment">// Rounds</span></div>
|
||||
<div class="line"><span class="lineno"> 131</span> <span class="keywordflow">for</span> (uint64_t chunk = 0; chunk * 64 < padded_message_size; chunk++) {</div>
|
||||
@@ -354,17 +373,9 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 202</span> </div>
|
||||
<div class="line"><span class="lineno"> 203</span> <span class="keywordflow">return</span> sig;</div>
|
||||
<div class="line"><span class="lineno"> 204</span>}</div>
|
||||
<div class="ttc" id="aarray_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a></div></div>
|
||||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a2f67508d5f392b0321772169342c98ad"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">numerical_methods::simpson_method::g</a></div><div class="ttdeci">double g(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> composite_simpson_rule.cpp:115</div></div>
|
||||
<div class="ttc" id="acopy_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/copy.html">std::copy</a></div><div class="ttdeci">T copy(T... args)</div></div>
|
||||
<div class="ttc" id="amd5_8cpp_html_add2bf982d5dd64a45d13cba52c2b371d"><div class="ttname"><a href="../../d5/d96/md5_8cpp.html#add2bf982d5dd64a45d13cba52c2b371d">hashing::md5::leftRotate32bits</a></div><div class="ttdeci">uint32_t leftRotate32bits(uint32_t n, std::size_t rotate)</div><div class="ttdoc">Rotates the bits of a 32-bit unsigned integer.</div><div class="ttdef"><b>Definition</b> md5.cpp:67</div></div>
|
||||
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d7a/sha1_8cpp_a7be3471f7e489d7d0df42b97a48bf141_cgraph.svg" width="340" height="86"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a2f67508d5f392b0321772169342c98ad"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">numerical_methods::simpson_method::g</a></div><div class="ttdeci">double g(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> <a href="../../d4/d18/composite__simpson__rule_8cpp_source.html#l00115">composite_simpson_rule.cpp:115</a></div></div>
|
||||
<div class="ttc" id="amd5_8cpp_html_add2bf982d5dd64a45d13cba52c2b371d"><div class="ttname"><a href="../../d5/d96/md5_8cpp.html#add2bf982d5dd64a45d13cba52c2b371d">hashing::md5::leftRotate32bits</a></div><div class="ttdeci">uint32_t leftRotate32bits(uint32_t n, std::size_t rotate)</div><div class="ttdoc">Rotates the bits of a 32-bit unsigned integer.</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d96/md5_8cpp_source.html#l00067">md5.cpp:67</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ac9e1a11f44135b890dd10a00e73b5661" name="ac9e1a11f44135b890dd10a00e73b5661"></a>
|
||||
@@ -392,40 +403,31 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00275">275</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 275</span> {</div>
|
||||
<div class="line"><span class="lineno"> 276</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||||
<div class="line"><span class="lineno"> 277</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> input;</div>
|
||||
<div class="line"><span class="lineno"> 278</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Enter a message to be hashed (Ctrl-C to exit): "</span></div>
|
||||
<div class="line"><span class="lineno"> 279</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 280</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/getline.html">std::getline</a>(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a>, input);</div>
|
||||
<div class="line"><span class="lineno"> 277</span> std::string input;</div>
|
||||
<div class="line"><span class="lineno"> 278</span> std::cout << <span class="stringliteral">"Enter a message to be hashed (Ctrl-C to exit): "</span></div>
|
||||
<div class="line"><span class="lineno"> 279</span> << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 280</span> std::getline(std::cin, input);</div>
|
||||
<div class="line"><span class="lineno"> 281</span> <span class="keywordtype">void</span>* sig = <a class="code hl_function" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a>(input);</div>
|
||||
<div class="line"><span class="lineno"> 282</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Hash is: "</span> << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 282</span> std::cout << <span class="stringliteral">"Hash is: "</span> << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig) << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 283</span> </div>
|
||||
<div class="line"><span class="lineno"> 284</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
|
||||
<div class="line"><span class="lineno"> 285</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Want to enter another message? (y/n) "</span>;</div>
|
||||
<div class="line"><span class="lineno"> 286</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/getline.html">std::getline</a>(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a>, input);</div>
|
||||
<div class="line"><span class="lineno"> 287</span> <span class="keywordflow">if</span> (input.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/compare.html">compare</a>(<span class="stringliteral">"y"</span>) == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 285</span> std::cout << <span class="stringliteral">"Want to enter another message? (y/n) "</span>;</div>
|
||||
<div class="line"><span class="lineno"> 286</span> std::getline(std::cin, input);</div>
|
||||
<div class="line"><span class="lineno"> 287</span> <span class="keywordflow">if</span> (input.compare(<span class="stringliteral">"y"</span>) == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 288</span> <span class="keywordflow">break</span>;</div>
|
||||
<div class="line"><span class="lineno"> 289</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (input.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/compare.html">compare</a>(<span class="stringliteral">"n"</span>) == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 289</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (input.compare(<span class="stringliteral">"n"</span>) == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 290</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><span class="lineno"> 291</span> }</div>
|
||||
<div class="line"><span class="lineno"> 292</span> }</div>
|
||||
<div class="line"><span class="lineno"> 293</span> }</div>
|
||||
<div class="line"><span class="lineno"> 294</span>}</div>
|
||||
<div class="ttc" id="abasic_istream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a></div></div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
|
||||
<div class="ttc" id="acompare_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/compare.html">std::string::compare</a></div><div class="ttdeci">T compare(T... args)</div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="agetline_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/getline.html">std::getline</a></div><div class="ttdeci">T getline(T... args)</div></div>
|
||||
<div class="ttc" id="asha1_8cpp_html_a2397f2444a05e4d1487c67e215410d3c"><div class="ttname"><a href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a></div><div class="ttdeci">void * hash(const std::string &message)</div><div class="ttdoc">Converts the string to bytestring and calls the main algorithm.</div><div class="ttdef"><b>Definition</b> sha1.cpp:211</div></div>
|
||||
<div class="ttc" id="asha1_8cpp_html_aada0803ef851d831b7a290a924e3c228"><div class="ttname"><a href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a></div><div class="ttdeci">std::string sig2hex(void *sig)</div><div class="ttdoc">Transforms the 160-bit SHA-1 signature into a 40 char hex string.</div><div class="ttdef"><b>Definition</b> sha1.cpp:67</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d7a/sha1_8cpp_ac9e1a11f44135b890dd10a00e73b5661_cgraph.svg" width="278" height="135"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="asha1_8cpp_html_a2397f2444a05e4d1487c67e215410d3c"><div class="ttname"><a href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a></div><div class="ttdeci">void * hash(const std::string &message)</div><div class="ttdoc">Converts the string to bytestring and calls the main algorithm.</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d7a/sha1_8cpp_source.html#l00211">sha1.cpp:211</a></div></div>
|
||||
<div class="ttc" id="asha1_8cpp_html_aada0803ef851d831b7a290a924e3c228"><div class="ttname"><a href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a></div><div class="ttdeci">std::string sig2hex(void *sig)</div><div class="ttdoc">Transforms the 160-bit SHA-1 signature into a 40 char hex string.</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d7a/sha1_8cpp_source.html#l00067">sha1.cpp:67</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="acf6bd970f29a68702bdbdfe8338e45e0" name="acf6bd970f29a68702bdbdfe8338e45e0"></a>
|
||||
@@ -442,7 +444,7 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a></td> <td class="paramname"><span class="paramname"><em>rotate</em></span> )</td>
|
||||
<td class="paramtype">std::size_t</td> <td class="paramname"><span class="paramname"><em>rotate</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
@@ -456,10 +458,11 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>uint32_t The rotated integer </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00058">58</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 58</span> {</div>
|
||||
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">return</span> (n << rotate) | (n >> (32 - <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/rotate.html">rotate</a>));</div>
|
||||
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">return</span> (n << rotate) | (n >> (32 - rotate));</div>
|
||||
<div class="line"><span class="lineno"> 60</span>}</div>
|
||||
<div class="ttc" id="arotate_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/rotate.html">std::rotate</a></div><div class="ttdeci">T rotate(T... args)</div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -480,6 +483,8 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00300">300</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 300</span> {</div>
|
||||
<div class="line"><span class="lineno"> 301</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><span class="lineno"> 302</span> </div>
|
||||
@@ -488,14 +493,9 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 305</span> <a class="code hl_function" href="#ac9e1a11f44135b890dd10a00e73b5661">interactive</a>();</div>
|
||||
<div class="line"><span class="lineno"> 306</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 307</span>}</div>
|
||||
<div class="ttc" id="asha1_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations of well-known SHA-1 hashes.</div><div class="ttdef"><b>Definition</b> sha1.cpp:221</div></div>
|
||||
<div class="ttc" id="asha1_8cpp_html_ac9e1a11f44135b890dd10a00e73b5661"><div class="ttname"><a href="#ac9e1a11f44135b890dd10a00e73b5661">interactive</a></div><div class="ttdeci">static void interactive()</div><div class="ttdoc">Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed.</div><div class="ttdef"><b>Definition</b> sha1.cpp:275</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d7a/sha1_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="375" height="184"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="asha1_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations of well-known SHA-1 hashes.</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d7a/sha1_8cpp_source.html#l00221">sha1.cpp:221</a></div></div>
|
||||
<div class="ttc" id="asha1_8cpp_html_ac9e1a11f44135b890dd10a00e73b5661"><div class="ttname"><a href="#ac9e1a11f44135b890dd10a00e73b5661">interactive</a></div><div class="ttdeci">static void interactive()</div><div class="ttdoc">Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed.</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d7a/sha1_8cpp_source.html#l00275">sha1.cpp:275</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="aada0803ef851d831b7a290a924e3c228" name="aada0803ef851d831b7a290a924e3c228"></a>
|
||||
@@ -505,7 +505,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> hashing::sha1::sig2hex </td>
|
||||
<td class="memname">std::string hashing::sha1::sig2hex </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>sig</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
@@ -520,18 +520,19 @@ Here is the call graph for this function:</div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> The hex signature </dd></dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>std::string The hex signature </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00067">67</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 67</span> {</div>
|
||||
<div class="line"><span class="lineno"> 68</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* hexChars = <span class="stringliteral">"0123456789abcdef"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 69</span> <span class="keyword">auto</span>* intsig = <span class="keyword">static_cast<</span>uint8_t*<span class="keyword">></span>(sig);</div>
|
||||
<div class="line"><span class="lineno"> 70</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/hex.html">hex</a> = <span class="stringliteral">""</span>;</div>
|
||||
<div class="line"><span class="lineno"> 70</span> std::string hex = <span class="stringliteral">""</span>;</div>
|
||||
<div class="line"><span class="lineno"> 71</span> <span class="keywordflow">for</span> (uint8_t i = 0; i < 20; i++) {</div>
|
||||
<div class="line"><span class="lineno"> 72</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/hex.html">hex</a>.push_back(hexChars[(intsig[i] >> 4) & 0xF]);</div>
|
||||
<div class="line"><span class="lineno"> 73</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/hex.html">hex</a>.push_back(hexChars[(intsig[i]) & 0xF]);</div>
|
||||
<div class="line"><span class="lineno"> 72</span> hex.push_back(hexChars[(intsig[i] >> 4) & 0xF]);</div>
|
||||
<div class="line"><span class="lineno"> 73</span> hex.push_back(hexChars[(intsig[i]) & 0xF]);</div>
|
||||
<div class="line"><span class="lineno"> 74</span> }</div>
|
||||
<div class="line"><span class="lineno"> 75</span> <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/hex.html">hex</a>;</div>
|
||||
<div class="line"><span class="lineno"> 75</span> <span class="keywordflow">return</span> hex;</div>
|
||||
<div class="line"><span class="lineno"> 76</span>}</div>
|
||||
<div class="ttc" id="ahex_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/hex.html">std::hex</a></div><div class="ttdeci">T hex(T... args)</div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -560,12 +561,14 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Self-test implementations of well-known SHA-1 hashes. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../d8/d7a/sha1_8cpp_source.html#l00221">221</a> of file <a class="el" href="../../d8/d7a/sha1_8cpp_source.html">sha1.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 221</span> {</div>
|
||||
<div class="line"><span class="lineno"> 222</span> <span class="comment">// Hashes empty string and stores signature</span></div>
|
||||
<div class="line"><span class="lineno"> 223</span> <span class="keywordtype">void</span>* sig = <a class="code hl_function" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a>(<span class="stringliteral">""</span>);</div>
|
||||
<div class="line"><span class="lineno"> 224</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Hashing empty string"</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 224</span> std::cout << <span class="stringliteral">"Hashing empty string"</span> << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 225</span> <span class="comment">// Prints signature hex representation</span></div>
|
||||
<div class="line"><span class="lineno"> 226</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 226</span> std::cout << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig) << std::endl << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 227</span> <span class="comment">// Test with cassert wether sig is correct from expected value</span></div>
|
||||
<div class="line"><span class="lineno"> 228</span> assert(hashing::sha1::sig2hex(sig).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
|
||||
<div class="line"><span class="lineno"> 229</span> <span class="stringliteral">"da39a3ee5e6b4b0d3255bfef95601890afd80709"</span>) == 0);</div>
|
||||
@@ -573,10 +576,10 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 231</span> <span class="comment">// Hashes "The quick brown fox jumps over the lazy dog" and stores signature</span></div>
|
||||
<div class="line"><span class="lineno"> 232</span> <span class="keywordtype">void</span>* sig2 =</div>
|
||||
<div class="line"><span class="lineno"> 233</span> <a class="code hl_function" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a>(<span class="stringliteral">"The quick brown fox jumps over the lazy dog"</span>);</div>
|
||||
<div class="line"><span class="lineno"> 234</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Hashing The quick brown fox jumps over the lazy dog"</span></div>
|
||||
<div class="line"><span class="lineno"> 235</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 234</span> std::cout << <span class="stringliteral">"Hashing The quick brown fox jumps over the lazy dog"</span></div>
|
||||
<div class="line"><span class="lineno"> 235</span> << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 236</span> <span class="comment">// Prints signature hex representation</span></div>
|
||||
<div class="line"><span class="lineno"> 237</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig2) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 237</span> std::cout << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig2) << std::endl << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 238</span> <span class="comment">// Test with cassert wether sig is correct from expected value</span></div>
|
||||
<div class="line"><span class="lineno"> 239</span> assert(hashing::sha1::sig2hex(sig2).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
|
||||
<div class="line"><span class="lineno"> 240</span> <span class="stringliteral">"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"</span>) == 0);</div>
|
||||
@@ -585,11 +588,11 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 243</span> <span class="comment">// additional period) and stores signature</span></div>
|
||||
<div class="line"><span class="lineno"> 244</span> <span class="keywordtype">void</span>* sig3 =</div>
|
||||
<div class="line"><span class="lineno"> 245</span> <a class="code hl_function" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a>(<span class="stringliteral">"The quick brown fox jumps over the lazy dog."</span>);</div>
|
||||
<div class="line"><span class="lineno"> 246</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Hashing "</span></div>
|
||||
<div class="line"><span class="lineno"> 246</span> std::cout << <span class="stringliteral">"Hashing "</span></div>
|
||||
<div class="line"><span class="lineno"> 247</span> <span class="stringliteral">"The quick brown fox jumps over the lazy dog."</span></div>
|
||||
<div class="line"><span class="lineno"> 248</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 248</span> << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 249</span> <span class="comment">// Prints signature hex representation</span></div>
|
||||
<div class="line"><span class="lineno"> 250</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig3) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 250</span> std::cout << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig3) << std::endl << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 251</span> <span class="comment">// Test with cassert wether sig is correct from expected value</span></div>
|
||||
<div class="line"><span class="lineno"> 252</span> assert(hashing::sha1::sig2hex(sig3).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
|
||||
<div class="line"><span class="lineno"> 253</span> <span class="stringliteral">"408d94384216f890ff7a0c3528e8bed1e0b01621"</span>) == 0);</div>
|
||||
@@ -598,23 +601,18 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 256</span> <span class="comment">// and stores signature</span></div>
|
||||
<div class="line"><span class="lineno"> 257</span> <span class="keywordtype">void</span>* sig4 = <a class="code hl_function" href="#a2397f2444a05e4d1487c67e215410d3c">hashing::sha1::hash</a>(</div>
|
||||
<div class="line"><span class="lineno"> 258</span> <span class="stringliteral">"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"</span>);</div>
|
||||
<div class="line"><span class="lineno"> 259</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div>
|
||||
<div class="line"><span class="lineno"> 259</span> std::cout</div>
|
||||
<div class="line"><span class="lineno"> 260</span> << <span class="stringliteral">"Hashing "</span></div>
|
||||
<div class="line"><span class="lineno"> 261</span> <span class="stringliteral">"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"</span></div>
|
||||
<div class="line"><span class="lineno"> 262</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 262</span> << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 263</span> <span class="comment">// Prints signature hex representation</span></div>
|
||||
<div class="line"><span class="lineno"> 264</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig4) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 264</span> std::cout << <a class="code hl_function" href="#aada0803ef851d831b7a290a924e3c228">hashing::sha1::sig2hex</a>(sig4) << std::endl << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 265</span> <span class="comment">// Test with cassert wether sig is correct from expected value</span></div>
|
||||
<div class="line"><span class="lineno"> 266</span> assert(hashing::sha1::sig2hex(sig4).<a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a>(</div>
|
||||
<div class="line"><span class="lineno"> 267</span> <span class="stringliteral">"761c457bf73b14d27e9e9265c46f4b4dda11f940"</span>) == 0);</div>
|
||||
<div class="line"><span class="lineno"> 268</span>}</div>
|
||||
<div class="ttc" id="ashell__sort2_8cpp_html_a7eb77daed2cf1513f6d68c47a1c2db1c"><div class="ttname"><a href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a></div><div class="ttdeci">int compare(const void *a, const void *b)</div><div class="ttdef"><b>Definition</b> shell_sort2.cpp:87</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d8/d7a/sha1_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="174" height="86"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="ashell__sort2_8cpp_html_a7eb77daed2cf1513f6d68c47a1c2db1c"><div class="ttname"><a href="../../d4/d7a/shell__sort2_8cpp.html#a7eb77daed2cf1513f6d68c47a1c2db1c">compare</a></div><div class="ttdeci">int compare(const void *a, const void *b)</div><div class="ttdef"><b>Definition</b> <a href="../../d4/d7a/shell__sort2_8cpp_source.html#l00087">shell_sort2.cpp:87</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
|
||||
Reference in New Issue
Block a user