MUtilities/docs/d2/dad/_hash_8h.html

298 lines
17 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MuldeR&#39;s Utilities for Qt: include/MUtils/Hash.h File Reference</title>
<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>
<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>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">MuldeR&#39;s Utilities for Qt
</div>
<div id="projectbrief">MUtilities</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="../../dir_b076b53667bc06ebb413a190e197fc7b.html">MUtils</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">Hash.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>This file contains function for cryptographic hash computation.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;<a class="el" href="../../d5/d3b/_global_8h_source.html">MUtils/Global.h</a>&gt;</code><br />
<code>#include &lt;QByteArray&gt;</code><br />
<code>#include &lt;QFile&gt;</code><br />
</div>
<p><a href="../../d2/dad/_hash_8h_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 name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html">MUtils::Hash::Hash</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">This abstract class specifies the generic interface for all support hash algorithms. <a href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:d3/da6/namespace_m_utils"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/da6/namespace_m_utils.html">MUtils</a></td></tr>
<tr class="memdesc:d3/da6/namespace_m_utils"><td class="mdescLeft">&#160;</td><td class="mdescRight">Global <a class="el" href="../../d3/da6/namespace_m_utils.html" title="Global MUtils namespace. ">MUtils</a> namespace. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a330b73d6927d6cd95892712f9396f40e"><td class="memItemLeft" align="right" valign="top">MUTILS_API Hash *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e">MUtils::Hash::create</a> (const quint16 &amp;hashId, const char *const key=NULL)</td></tr>
<tr class="memdesc:a330b73d6927d6cd95892712f9396f40e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create instance of a hash function. <a href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e">More...</a><br /></td></tr>
<tr class="separator:a330b73d6927d6cd95892712f9396f40e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:aa9e34ac422f4e52061cb8908f922fe17"><td class="memItemLeft" align="right" valign="top">static const quint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dad/_hash_8h.html#aa9e34ac422f4e52061cb8908f922fe17">MUtils::Hash::HASH_BLAKE2_512</a> = 0x0000U</td></tr>
<tr class="memdesc:aa9e34ac422f4e52061cb8908f922fe17"><td class="mdescLeft">&#160;</td><td class="mdescRight"><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> algorithm identifier. <a href="../../d2/dad/_hash_8h.html#aa9e34ac422f4e52061cb8908f922fe17">More...</a><br /></td></tr>
<tr class="separator:aa9e34ac422f4e52061cb8908f922fe17"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3cfb72f121ca5c03dd8452c322549d11"><td class="memItemLeft" align="right" valign="top">static const quint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dad/_hash_8h.html#a3cfb72f121ca5c03dd8452c322549d11">MUtils::Hash::HASH_KECCAK_224</a> = 0x0100U</td></tr>
<tr class="memdesc:a3cfb72f121ca5c03dd8452c322549d11"><td class="mdescLeft">&#160;</td><td class="mdescRight"><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> algorithm identifier. <a href="../../d2/dad/_hash_8h.html#a3cfb72f121ca5c03dd8452c322549d11">More...</a><br /></td></tr>
<tr class="separator:a3cfb72f121ca5c03dd8452c322549d11"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae38cda07e425eb7c745492215a48ae08"><td class="memItemLeft" align="right" valign="top">static const quint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dad/_hash_8h.html#ae38cda07e425eb7c745492215a48ae08">MUtils::Hash::HASH_KECCAK_256</a> = 0x0101U</td></tr>
<tr class="memdesc:ae38cda07e425eb7c745492215a48ae08"><td class="mdescLeft">&#160;</td><td class="mdescRight"><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> algorithm identifier. <a href="../../d2/dad/_hash_8h.html#ae38cda07e425eb7c745492215a48ae08">More...</a><br /></td></tr>
<tr class="separator:ae38cda07e425eb7c745492215a48ae08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af80dfb1569816fab7ab5ed32e6386458"><td class="memItemLeft" align="right" valign="top">static const quint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dad/_hash_8h.html#af80dfb1569816fab7ab5ed32e6386458">MUtils::Hash::HASH_KECCAK_384</a> = 0x0102U</td></tr>
<tr class="memdesc:af80dfb1569816fab7ab5ed32e6386458"><td class="mdescLeft">&#160;</td><td class="mdescRight"><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> algorithm identifier. <a href="../../d2/dad/_hash_8h.html#af80dfb1569816fab7ab5ed32e6386458">More...</a><br /></td></tr>
<tr class="separator:af80dfb1569816fab7ab5ed32e6386458"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89ad922f2cada9a15893852d43134119"><td class="memItemLeft" align="right" valign="top">static const quint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/dad/_hash_8h.html#a89ad922f2cada9a15893852d43134119">MUtils::Hash::HASH_KECCAK_512</a> = 0x0103U</td></tr>
<tr class="memdesc:a89ad922f2cada9a15893852d43134119"><td class="mdescLeft">&#160;</td><td class="mdescRight"><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> algorithm identifier. <a href="../../d2/dad/_hash_8h.html#a89ad922f2cada9a15893852d43134119">More...</a><br /></td></tr>
<tr class="separator:a89ad922f2cada9a15893852d43134119"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This file contains function for cryptographic hash computation. </p>
<p>Call the <a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e" title="Create instance of a hash function. ">MUtils::Hash::create()</a> function to create an instance of the desired hash function. All Hash functions implement the <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. ">MUtils::Hash::Hash</a> interface. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="file_a330b73d6927d6cd95892712f9396f40e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a330b73d6927d6cd95892712f9396f40e">&sect;&nbsp;</a></span>create()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">MUTILS_API Hash* MUtils::Hash::create </td>
<td>(</td>
<td class="paramtype">const quint16 &amp;&#160;</td>
<td class="paramname"><em>hashId</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *const&#160;</td>
<td class="paramname"><em>key</em> = <code>NULL</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create instance of a hash function. </p>
<p>This function is used to create a new instance of the desired hash function. All Hash functions implement the <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. ">MUtils::Hash::Hash</a> interface. The caller is responsible for destroying the returned <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. ">MUtils::Hash::Hash</a> object.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">hashId</td><td>Specifies the desired hash function. This must be a valid hash algorithm identifier, as defined in the <code><a class="el" href="../../d2/dad/_hash_8h.html" title="This file contains function for cryptographic hash computation. ">Hash.h</a></code> header file.</td></tr>
<tr><td class="paramname">key</td><td>Specifies on optional key that is used to "seed" the hash function. If a key is given, it must be a NULL-terminated string of appropriate length. If set to <code>NULL</code>, the optional seeding is skipped.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns a pointer to a new <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. ">MUtils::Hash::Hash</a> object that implements the desired hash function. The function throws if an invalid algorithm identifier was specified! </dd></dl>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="file_aa9e34ac422f4e52061cb8908f922fe17"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_aa9e34ac422f4e52061cb8908f922fe17">&sect;&nbsp;</a></span>HASH_BLAKE2_512</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const quint16 MUtils::Hash::HASH_BLAKE2_512 = 0x0000U</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Hash algorithm identifier. </p>
<p>Use <a href="https://blake2.net/">BLAKE2</a> hash algorithm, with a length of 512-Bit. </p>
</div>
</div>
<a id="file_a3cfb72f121ca5c03dd8452c322549d11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a3cfb72f121ca5c03dd8452c322549d11">&sect;&nbsp;</a></span>HASH_KECCAK_224</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const quint16 MUtils::Hash::HASH_KECCAK_224 = 0x0100U</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Hash algorithm identifier. </p>
<p>Use <a href="http://keccak.noekeon.org/">Keccak</a> (SHA-3) hash algorithm, with a length of 224-Bit. </p>
</div>
</div>
<a id="file_ae38cda07e425eb7c745492215a48ae08"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_ae38cda07e425eb7c745492215a48ae08">&sect;&nbsp;</a></span>HASH_KECCAK_256</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const quint16 MUtils::Hash::HASH_KECCAK_256 = 0x0101U</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Hash algorithm identifier. </p>
<p>Use <a href="http://keccak.noekeon.org/">Keccak</a> (SHA-3) hash algorithm, with a length of 256-Bit. </p>
</div>
</div>
<a id="file_af80dfb1569816fab7ab5ed32e6386458"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_af80dfb1569816fab7ab5ed32e6386458">&sect;&nbsp;</a></span>HASH_KECCAK_384</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const quint16 MUtils::Hash::HASH_KECCAK_384 = 0x0102U</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Hash algorithm identifier. </p>
<p>Use <a href="http://keccak.noekeon.org/">Keccak</a> (SHA-3) hash algorithm, with a length of 384-Bit. </p>
</div>
</div>
<a id="file_a89ad922f2cada9a15893852d43134119"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a89ad922f2cada9a15893852d43134119">&sect;&nbsp;</a></span>HASH_KECCAK_512</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const quint16 MUtils::Hash::HASH_KECCAK_512 = 0x0103U</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Hash algorithm identifier. </p>
<p>Use <a href="http://keccak.noekeon.org/">Keccak</a> (SHA-3) hash algorithm, with a length of 512-Bit. </p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>