1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.12"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>MuldeR's Utilities for Qt: MUtils::Hash::Hash Class Reference</title>
9 <link href="../../tabs.css" rel="stylesheet" type="text/css"/>
10 <script type="text/javascript" src="../../jquery.js"></script>
11 <script type="text/javascript" src="../../dynsections.js"></script>
12 <link href="../../search/search.css" rel="stylesheet" type="text/css"/>
13 <script type="text/javascript" src="../../search/searchdata.js"></script>
14 <script type="text/javascript" src="../../search/search.js"></script>
15 <link href="../../doxygen.css" rel="stylesheet" type="text/css" />
18 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
20 <table cellspacing="0" cellpadding="0">
22 <tr style="height: 56px;">
23 <td id="projectalign" style="padding-left: 0.5em;">
24 <div id="projectname">MuldeR's Utilities for Qt
26 <div id="projectbrief">MUtilities</div>
32 <!-- end header part -->
33 <!-- Generated by Doxygen 1.8.12 -->
34 <script type="text/javascript">
35 var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
37 <script type="text/javascript" src="../../menudata.js"></script>
38 <script type="text/javascript" src="../../menu.js"></script>
39 <script type="text/javascript">
41 initMenu('../../',true,false,'search.php','Search');
42 $(document).ready(function() { init_search(); });
45 <div id="main-nav"></div>
46 <!-- window showing the filter options -->
47 <div id="MSearchSelectWindow"
48 onmouseover="return searchBox.OnSearchSelectShow()"
49 onmouseout="return searchBox.OnSearchSelectHide()"
50 onkeydown="return searchBox.OnSearchSelectKey(event)">
53 <!-- iframe showing the search results (closed by default) -->
54 <div id="MSearchResultsWindow">
55 <iframe src="javascript:void(0)" frameborder="0"
56 name="MSearchResults" id="MSearchResults">
60 <div id="nav-path" class="navpath">
62 <li class="navelem"><a class="el" href="../../d3/da6/namespace_m_utils.html">MUtils</a></li><li class="navelem"><b>Hash</b></li><li class="navelem"><a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html">Hash</a></li> </ul>
67 <a href="#pub-methods">Public Member Functions</a> |
68 <a href="#pro-methods">Protected Member Functions</a> |
69 <a href="../../d2/ded/class_m_utils_1_1_hash_1_1_hash-members.html">List of all members</a> </div>
70 <div class="headertitle">
71 <div class="title">MUtils::Hash::Hash Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
73 <div class="contents">
75 <p>This abstract class specifies the generic interface for all support hash algorithms.
76 <a href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#details">More...</a></p>
78 <p><code>#include <<a class="el" href="../../d2/dad/_hash_8h_source.html">Hash.h</a>></code></p>
79 <table class="memberdecls">
80 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
81 Public Member Functions</h2></td></tr>
82 <tr class="memitem:a5c36bd2ea671928f9f5bd897dcfbef15"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#a5c36bd2ea671928f9f5bd897dcfbef15">update</a> (const quint8 *const data, const quint32 len)</td></tr>
83 <tr class="memdesc:a5c36bd2ea671928f9f5bd897dcfbef15"><td class="mdescLeft"> </td><td class="mdescRight">Process the next chunk of input data. <a href="#a5c36bd2ea671928f9f5bd897dcfbef15">More...</a><br /></td></tr>
84 <tr class="separator:a5c36bd2ea671928f9f5bd897dcfbef15"><td class="memSeparator" colspan="2"> </td></tr>
85 <tr class="memitem:a16bef08766de745913b3fd7c338bf5aa"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#a16bef08766de745913b3fd7c338bf5aa">update</a> (const QByteArray &data)</td></tr>
86 <tr class="memdesc:a16bef08766de745913b3fd7c338bf5aa"><td class="mdescLeft"> </td><td class="mdescRight">Process the next chunk of input data. <a href="#a16bef08766de745913b3fd7c338bf5aa">More...</a><br /></td></tr>
87 <tr class="separator:a16bef08766de745913b3fd7c338bf5aa"><td class="memSeparator" colspan="2"> </td></tr>
88 <tr class="memitem:ace90c97585350dd246b6c655a3de571f"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#ace90c97585350dd246b6c655a3de571f">update</a> (QFile &file)</td></tr>
89 <tr class="memdesc:ace90c97585350dd246b6c655a3de571f"><td class="mdescLeft"> </td><td class="mdescRight">Process the next chunk of input data. <a href="#ace90c97585350dd246b6c655a3de571f">More...</a><br /></td></tr>
90 <tr class="separator:ace90c97585350dd246b6c655a3de571f"><td class="memSeparator" colspan="2"> </td></tr>
91 <tr class="memitem:a1d70f2b647935868a178920196ec0ac1"><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#a1d70f2b647935868a178920196ec0ac1">digest</a> (const bool bAsHex=true)</td></tr>
92 <tr class="memdesc:a1d70f2b647935868a178920196ec0ac1"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the hash value. <a href="#a1d70f2b647935868a178920196ec0ac1">More...</a><br /></td></tr>
93 <tr class="separator:a1d70f2b647935868a178920196ec0ac1"><td class="memSeparator" colspan="2"> </td></tr>
94 </table><table class="memberdecls">
95 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
96 Protected Member Functions</h2></td></tr>
97 <tr class="memitem:ad6e33a1ff4e7e2f8247fa33ca4f7b16c"><td class="memItemLeft" align="right" valign="top"><a id="ad6e33a1ff4e7e2f8247fa33ca4f7b16c"></a>
98  </td><td class="memItemRight" valign="bottom"><b>Hash</b> (const char *=NULL)</td></tr>
99 <tr class="separator:ad6e33a1ff4e7e2f8247fa33ca4f7b16c"><td class="memSeparator" colspan="2"> </td></tr>
100 <tr class="memitem:a498fa946e1cc599f85f745337f2263b9"><td class="memItemLeft" align="right" valign="top"><a id="a498fa946e1cc599f85f745337f2263b9"></a>
101 virtual bool </td><td class="memItemRight" valign="bottom"><b>process</b> (const quint8 *const data, const quint32 len)=0</td></tr>
102 <tr class="separator:a498fa946e1cc599f85f745337f2263b9"><td class="memSeparator" colspan="2"> </td></tr>
103 <tr class="memitem:ae2a22f932e25961380e796e245fddf89"><td class="memItemLeft" align="right" valign="top"><a id="ae2a22f932e25961380e796e245fddf89"></a>
104 virtual QByteArray </td><td class="memItemRight" valign="bottom"><b>finalize</b> (void)=0</td></tr>
105 <tr class="separator:ae2a22f932e25961380e796e245fddf89"><td class="memSeparator" colspan="2"> </td></tr>
107 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
108 <div class="textblock"><p>This abstract class specifies the generic interface for all support hash algorithms. </p>
109 <p>In order to compute a hash value (digest) call the the <a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#a5c36bd2ea671928f9f5bd897dcfbef15" title="Process the next chunk of input data. ">Hash::update()</a> function repeatedly until all input data (i.e. the complete "message") has been processed. Then call the <a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#a1d70f2b647935868a178920196ec0ac1" title="Retrieve the hash value. ">Hash::digest()</a> function to retrieve the final hash value.</p>
110 <p>All overloads of the <a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#a5c36bd2ea671928f9f5bd897dcfbef15" title="Process the next chunk of input data. ">Hash::update()</a> function may be called in an interleaved fashion as needed.</p>
111 <p>This class is <b>not</b> thread-safe, i.e. do <b>not</b> call the <em>same</em> <a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html" title="This abstract class specifies the generic interface for all support hash algorithms. ">Hash</a> instance from difference threads, unless serialization is ensured (e.g. by means of a Mutex). It is safe, however, to call different <em>different</em> <a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html" title="This abstract class specifies the generic interface for all support hash algorithms. ">Hash</a> instances from difference threads concurrently. </p>
112 </div><h2 class="groupheader">Member Function Documentation</h2>
113 <a id="a1d70f2b647935868a178920196ec0ac1"></a>
114 <h2 class="memtitle"><span class="permalink"><a href="#a1d70f2b647935868a178920196ec0ac1">§ </a></span>digest()</h2>
116 <div class="memitem">
117 <div class="memproto">
118 <table class="mlabels">
120 <td class="mlabels-left">
121 <table class="memname">
123 <td class="memname">QByteArray MUtils::Hash::Hash::digest </td>
125 <td class="paramtype">const bool </td>
126 <td class="paramname"><em>bAsHex</em> = <code>true</code></td><td>)</td>
131 <td class="mlabels-right">
132 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
135 </div><div class="memdoc">
137 <p>Retrieve the hash value. </p>
138 <p>This function is used to retrieve the final hash value (digest), after all input data has been processed successfully.</p>
139 <dl class="params"><dt>Parameters</dt><dd>
140 <table class="params">
141 <tr><td class="paramname">bAsHex</td><td>If set to <code>true</code>, the function returns the hash value as a Hexadecimal-encoded ASCII string; if set to <code>false</code>, the function returns the hash value as "raw" bytes.</td></tr>
145 <dl class="section return"><dt>Returns</dt><dd>The function returns a QByteArray object holding the final hash value (digest). The format depends on the <code>bAsHex</code> parameter. </dd></dl>
149 <a id="a5c36bd2ea671928f9f5bd897dcfbef15"></a>
150 <h2 class="memtitle"><span class="permalink"><a href="#a5c36bd2ea671928f9f5bd897dcfbef15">§ </a></span>update() <span class="overload">[1/3]</span></h2>
152 <div class="memitem">
153 <div class="memproto">
154 <table class="mlabels">
156 <td class="mlabels-left">
157 <table class="memname">
159 <td class="memname">bool MUtils::Hash::Hash::update </td>
161 <td class="paramtype">const quint8 *const </td>
162 <td class="paramname"><em>data</em>, </td>
165 <td class="paramkey"></td>
167 <td class="paramtype">const quint32 </td>
168 <td class="paramname"><em>len</em> </td>
177 <td class="mlabels-right">
178 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
181 </div><div class="memdoc">
183 <p>Process the next chunk of input data. </p>
184 <p>Updates the internal state of the hash function by processing the next chunk of input that. Can be called repeatedly, until until all input data has been processed.</p>
185 <dl class="params"><dt>Parameters</dt><dd>
186 <table class="params">
187 <tr><td class="paramname">data</td><td>A read-only pointer to the memory buffer holding the input data to be processed.</td></tr>
188 <tr><td class="paramname">len</td><td>The length of the input data, in bytes. The <code>data</code> parameter must be pointing to a memory buffer that is at least <code>len</code> bytes in size.</td></tr>
192 <dl class="section return"><dt>Returns</dt><dd>The function returns <code>true</code>, if the input data was processed successfully; otherwise it returns <code>false</code>. </dd></dl>
196 <a id="a16bef08766de745913b3fd7c338bf5aa"></a>
197 <h2 class="memtitle"><span class="permalink"><a href="#a16bef08766de745913b3fd7c338bf5aa">§ </a></span>update() <span class="overload">[2/3]</span></h2>
199 <div class="memitem">
200 <div class="memproto">
201 <table class="mlabels">
203 <td class="mlabels-left">
204 <table class="memname">
206 <td class="memname">bool MUtils::Hash::Hash::update </td>
208 <td class="paramtype">const QByteArray & </td>
209 <td class="paramname"><em>data</em></td><td>)</td>
214 <td class="mlabels-right">
215 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
218 </div><div class="memdoc">
220 <p>Process the next chunk of input data. </p>
221 <p>Updates the internal state of the hash function by processing the next chunk of input that. Can be called repeatedly, until until all input data has been processed.</p>
222 <dl class="params"><dt>Parameters</dt><dd>
223 <table class="params">
224 <tr><td class="paramname">data</td><td>A read-only reference to a QByteArray object holding the input data to be processed. All bytes in the QByteArray object will be processed.</td></tr>
228 <dl class="section return"><dt>Returns</dt><dd>The function returns <code>true</code>, if the input data was processed successfully; otherwise it returns <code>false</code>. </dd></dl>
232 <a id="ace90c97585350dd246b6c655a3de571f"></a>
233 <h2 class="memtitle"><span class="permalink"><a href="#ace90c97585350dd246b6c655a3de571f">§ </a></span>update() <span class="overload">[3/3]</span></h2>
235 <div class="memitem">
236 <div class="memproto">
237 <table class="memname">
239 <td class="memname">bool MUtils::Hash::Hash::update </td>
241 <td class="paramtype">QFile & </td>
242 <td class="paramname"><em>file</em></td><td>)</td>
246 </div><div class="memdoc">
248 <p>Process the next chunk of input data. </p>
249 <p>Updates the internal state of the hash function by processing the next chunk of input that. Can be called repeatedly, until until all input data has been processed.</p>
250 <dl class="params"><dt>Parameters</dt><dd>
251 <table class="params">
252 <tr><td class="paramname">data</td><td>A reference to a QFile object. The QFile object must be open and readable. All data from the current file position to the end of the file will be processed.</td></tr>
256 <dl class="section return"><dt>Returns</dt><dd>The function returns <code>true</code>, if all data in the file was processed successfully; otherwise (e.g. in case of file read errors) it returns <code>false</code>. </dd></dl>
260 <hr/>The documentation for this class was generated from the following file:<ul>
261 <li>include/MUtils/<a class="el" href="../../d2/dad/_hash_8h_source.html">Hash.h</a></li>
263 </div><!-- contents -->
264 <!-- start footer part -->
265 <hr class="footer"/><address class="footer"><small>
266 Generated by  <a href="http://www.doxygen.org/index.html">
267 <img class="footer" src="../../doxygen.png" alt="doxygen"/>