TheAlgorithms-C/d7/d3b/group__hash.html
2023-06-20 21:10:10 +00:00

1372 lines
102 KiB
HTML

<!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>
<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.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C: Hash algorithms</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="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.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>
<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>
<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>
<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 id="projectrow">
<td id="projectalign">
<div id="projectname">Algorithms_in_C<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('d7/d3b/group__hash.html','../../'); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#files">Files</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">Hash algorithms</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="files" name="files"></a>
Files</h2></td></tr>
<tr class="memitem:d3/d39/hash__adler32_8c"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d39/hash__adler32_8c.html">hash_adler32.c</a></td></tr>
<tr class="memdesc:d3/d39/hash__adler32_8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">32-bit <a href="https://en.wikipedia.org/wiki/Adler-32" target="_blank">Adler hash</a> algorithm <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:dc/d1d/hash__blake2b_8c"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dc/d1d/hash__blake2b_8c.html">hash_blake2b.c</a></td></tr>
<tr class="memdesc:dc/d1d/hash__blake2b_8c"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a href="https://www.rfc-editor.org/rfc/rfc7693" target="_blank">Blake2b cryptographic hash function</a> <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:d9/dc9/hash__crc32_8c"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/dc9/hash__crc32_8c.html">hash_crc32.c</a></td></tr>
<tr class="memdesc:d9/dc9/hash__crc32_8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">32-bit <a href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check#CRC-32_algorithm" target="_blank">CRC hash</a> algorithm <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:d4/de3/hash__djb2_8c"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/de3/hash__djb2_8c.html">hash_djb2.c</a></td></tr>
<tr class="memdesc:d4/de3/hash__djb2_8c"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a href="http://www.cse.yorku.ca/~oz/hash.html" target="_blank">DJB2 hash algorithm</a> <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:d7/d0c/hash__sdbm_8c"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d0c/hash__sdbm_8c.html">hash_sdbm.c</a></td></tr>
<tr class="memdesc:d7/d0c/hash__sdbm_8c"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a href="http://www.cse.yorku.ca/~oz/hash.html" target="_blank">SDBM hash algorithm</a> <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:d0/d57/hash__xor8_8c"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d57/hash__xor8_8c.html">hash_xor8.c</a></td></tr>
<tr class="memdesc:d0/d57/hash__xor8_8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">8-bit <a href="https://en.wikipedia.org/wiki/XOR_cipher" target="_blank">XOR hash</a> algorithm for ASCII characters <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 id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gafe4fb267f5fd876bc5f069b0a76054e4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>&#160;&#160;&#160;128</td></tr>
<tr class="memdesc:gafe4fb267f5fd876bc5f069b0a76054e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">for asserts <br /></td></tr>
<tr class="separator:gafe4fb267f5fd876bc5f069b0a76054e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1ee4dc21c835217a5a1dddfb48b43063"><td class="memItemLeft" align="right" valign="top"><a id="ga1ee4dc21c835217a5a1dddfb48b43063" name="ga1ee4dc21c835217a5a1dddfb48b43063"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>KK_MAX</b>&#160;&#160;&#160;64</td></tr>
<tr class="memdesc:ga1ee4dc21c835217a5a1dddfb48b43063"><td class="mdescLeft">&#160;</td><td class="mdescRight">max key length for BLAKE2b <br /></td></tr>
<tr class="separator:ga1ee4dc21c835217a5a1dddfb48b43063"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga27e69b76332a4a7e970d2b4e29674cff"><td class="memItemLeft" align="right" valign="top"><a id="ga27e69b76332a4a7e970d2b4e29674cff" name="ga27e69b76332a4a7e970d2b4e29674cff"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>NN_MAX</b>&#160;&#160;&#160;64</td></tr>
<tr class="memdesc:ga27e69b76332a4a7e970d2b4e29674cff"><td class="mdescLeft">&#160;</td><td class="mdescRight">max length of BLAKE2b digest in bytes <br /></td></tr>
<tr class="separator:ga27e69b76332a4a7e970d2b4e29674cff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa6921cfca101af04b9dcc8d29bc7b16"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gafa6921cfca101af04b9dcc8d29bc7b16">CEIL</a>(a, b)&#160;&#160;&#160;(((a) / (b)) + ((a) % (b) != 0))</td></tr>
<tr class="memdesc:gafa6921cfca101af04b9dcc8d29bc7b16"><td class="mdescLeft">&#160;</td><td class="mdescRight">ceiling division macro without floats <br /></td></tr>
<tr class="separator:gafa6921cfca101af04b9dcc8d29bc7b16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3acffbd305ee72dcd4593c0d8af64a4f"><td class="memItemLeft" align="right" valign="top"><a id="ga3acffbd305ee72dcd4593c0d8af64a4f" name="ga3acffbd305ee72dcd4593c0d8af64a4f"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MIN</b>(a, b)&#160;&#160;&#160;((a) &lt; (b) ? (a) : (b))</td></tr>
<tr class="memdesc:ga3acffbd305ee72dcd4593c0d8af64a4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">returns minimum value <br /></td></tr>
<tr class="separator:ga3acffbd305ee72dcd4593c0d8af64a4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="memItemLeft" align="right" valign="top"><a id="gafa99ec4acc4ecb2dc3c2d05da15d0e3f" name="gafa99ec4acc4ecb2dc3c2d05da15d0e3f"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MAX</b>(a, b)&#160;&#160;&#160;((a) &gt; (b) ? (a) : (b))</td></tr>
<tr class="memdesc:gafa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="mdescLeft">&#160;</td><td class="mdescRight">returns maximum value <br /></td></tr>
<tr class="separator:gafa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1293f9b91cd85591875a9453ba71f1a3"><td class="memItemLeft" align="right" valign="top"><a id="ga1293f9b91cd85591875a9453ba71f1a3" name="ga1293f9b91cd85591875a9453ba71f1a3"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>ROTR64</b>(n, offset)&#160;&#160;&#160;(((n) &gt;&gt; (offset)) ^ ((n) &lt;&lt; (64 - (offset))))</td></tr>
<tr class="memdesc:ga1293f9b91cd85591875a9453ba71f1a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">macro to rotate 64-bit ints to the right Ripped from RFC 7693 <br /></td></tr>
<tr class="separator:ga1293f9b91cd85591875a9453ba71f1a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaaf1984a095293c68f7dad2d31790ec3b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gaaf1984a095293c68f7dad2d31790ec3b">U128_ZERO</a></td></tr>
<tr class="memdesc:gaaf1984a095293c68f7dad2d31790ec3b"><td class="mdescLeft">&#160;</td><td class="mdescRight">zero-value initializer for u128 type <br /></td></tr>
<tr class="separator:gaaf1984a095293c68f7dad2d31790ec3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gac7cf56cc7cc7b14ceded8253b45db728"><td class="memItemLeft" align="right" valign="top"><a id="gac7cf56cc7cc7b14ceded8253b45db728" name="gac7cf56cc7cc7b14ceded8253b45db728"></a>
typedef uint64_t&#160;</td><td class="memItemRight" valign="bottom"><b>u128</b>[2]</td></tr>
<tr class="memdesc:gac7cf56cc7cc7b14ceded8253b45db728"><td class="mdescLeft">&#160;</td><td class="mdescRight">128-bit number represented as two uint64's <br /></td></tr>
<tr class="separator:gac7cf56cc7cc7b14ceded8253b45db728"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad587ec486728a1423ca04c21482e0685"><td class="memItemLeft" align="right" valign="top"><a id="gad587ec486728a1423ca04c21482e0685" name="gad587ec486728a1423ca04c21482e0685"></a>
typedef uint64_t&#160;</td><td class="memItemRight" valign="bottom"><b>block_t</b>[<a class="el" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>/sizeof(uint64_t)]</td></tr>
<tr class="memdesc:gad587ec486728a1423ca04c21482e0685"><td class="mdescLeft">&#160;</td><td class="mdescRight">Padded input block containing bb bytes. <br /></td></tr>
<tr class="separator:gad587ec486728a1423ca04c21482e0685"><td class="memSeparator" colspan="2">&#160;</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:ga506f0227a3b5f9434a503e09a3cb672b"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b">adler32</a> (const char *s)</td></tr>
<tr class="memdesc:ga506f0227a3b5f9434a503e09a3cb672b"><td class="mdescLeft">&#160;</td><td class="mdescRight">32-bit Adler algorithm implementation <br /></td></tr>
<tr class="separator:ga506f0227a3b5f9434a503e09a3cb672b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga994ea8b243b6c0fbef734551ec5765dd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga994ea8b243b6c0fbef734551ec5765dd">test_adler32</a> ()</td></tr>
<tr class="memdesc:ga994ea8b243b6c0fbef734551ec5765dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b" title="32-bit Adler algorithm implementation">adler32</a>. <br /></td></tr>
<tr class="separator:ga994ea8b243b6c0fbef734551ec5765dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga94c9f3e74306c2b7ac5f141d8454dbe9"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga94c9f3e74306c2b7ac5f141d8454dbe9">u128_fill</a> (<a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a> dest, size_t n)</td></tr>
<tr class="memdesc:ga94c9f3e74306c2b7ac5f141d8454dbe9"><td class="mdescLeft">&#160;</td><td class="mdescRight">put value of n into dest <br /></td></tr>
<tr class="separator:ga94c9f3e74306c2b7ac5f141d8454dbe9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaead2e4f50d0c512905c07ddd564e082e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gaead2e4f50d0c512905c07ddd564e082e">u128_increment</a> (<a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a> dest, uint64_t n)</td></tr>
<tr class="memdesc:gaead2e4f50d0c512905c07ddd564e082e"><td class="mdescLeft">&#160;</td><td class="mdescRight">increment an 128-bit number by a given amount <br /></td></tr>
<tr class="separator:gaead2e4f50d0c512905c07ddd564e082e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga049d44b5a4804ca5a1b7a290f3fa3202"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a> (<a class="el" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a> v, uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint64_t x, uint64_t y)</td></tr>
<tr class="memdesc:ga049d44b5a4804ca5a1b7a290f3fa3202"><td class="mdescLeft">&#160;</td><td class="mdescRight">blake2b mixing function G <br /></td></tr>
<tr class="separator:ga049d44b5a4804ca5a1b7a290f3fa3202"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga37e02cbf2df2247d31ab92f443990dbd"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga37e02cbf2df2247d31ab92f443990dbd">F</a> (uint64_t h[8], <a class="el" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a> m, <a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a> t, int f)</td></tr>
<tr class="memdesc:ga37e02cbf2df2247d31ab92f443990dbd"><td class="mdescLeft">&#160;</td><td class="mdescRight">compression function F <br /></td></tr>
<tr class="separator:ga37e02cbf2df2247d31ab92f443990dbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa42f7c30fb9921ba2eafa8b68b23582"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gafa42f7c30fb9921ba2eafa8b68b23582">BLAKE2B</a> (uint8_t *dest, <a class="el" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a> *d, size_t dd, <a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a> ll, uint8_t kk, uint8_t nn)</td></tr>
<tr class="memdesc:gafa42f7c30fb9921ba2eafa8b68b23582"><td class="mdescLeft">&#160;</td><td class="mdescRight">driver function to perform the hashing as described in specification <br /></td></tr>
<tr class="separator:gafa42f7c30fb9921ba2eafa8b68b23582"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf2cd4bc8e8097fff865741a0efc42eca"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gaf2cd4bc8e8097fff865741a0efc42eca">blake2b</a> (const uint8_t *message, size_t len, const uint8_t *key, uint8_t kk, uint8_t nn)</td></tr>
<tr class="memdesc:gaf2cd4bc8e8097fff865741a0efc42eca"><td class="mdescLeft">&#160;</td><td class="mdescRight">blake2b hash function <br /></td></tr>
<tr class="separator:gaf2cd4bc8e8097fff865741a0efc42eca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga483e7ee6db1dc09a0f3e683e028ec567"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567">crc32</a> (const char *s)</td></tr>
<tr class="memdesc:ga483e7ee6db1dc09a0f3e683e028ec567"><td class="mdescLeft">&#160;</td><td class="mdescRight">32-bit CRC algorithm implementation <br /></td></tr>
<tr class="separator:ga483e7ee6db1dc09a0f3e683e028ec567"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad451622bbdca271edfa8e0d98ca422f2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gad451622bbdca271edfa8e0d98ca422f2">test_crc32</a> ()</td></tr>
<tr class="memdesc:gad451622bbdca271edfa8e0d98ca422f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567" title="32-bit CRC algorithm implementation">crc32</a>. <br /></td></tr>
<tr class="separator:gad451622bbdca271edfa8e0d98ca422f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1ac362fa25f7c35d104205985f8e754b"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b">djb2</a> (const char *s)</td></tr>
<tr class="memdesc:ga1ac362fa25f7c35d104205985f8e754b"><td class="mdescLeft">&#160;</td><td class="mdescRight">DJB2 algorithm implementation. <br /></td></tr>
<tr class="separator:ga1ac362fa25f7c35d104205985f8e754b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9f76001544014905468dc812336110d5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga9f76001544014905468dc812336110d5">test_djb2</a> (void)</td></tr>
<tr class="memdesc:ga9f76001544014905468dc812336110d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b" title="DJB2 algorithm implementation.">djb2</a>. <br /></td></tr>
<tr class="separator:ga9f76001544014905468dc812336110d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8ab8eeb35f8ccfcad89091b5fdd4f605"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605">sdbm</a> (const char *s)</td></tr>
<tr class="memdesc:ga8ab8eeb35f8ccfcad89091b5fdd4f605"><td class="mdescLeft">&#160;</td><td class="mdescRight">SDBM algorithm implementation. <br /></td></tr>
<tr class="separator:ga8ab8eeb35f8ccfcad89091b5fdd4f605"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab87679863646255178427a56dc33e453"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gab87679863646255178427a56dc33e453">test_sdbm</a> ()</td></tr>
<tr class="memdesc:gab87679863646255178427a56dc33e453"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605" title="SDBM algorithm implementation.">sdbm</a>. <br /></td></tr>
<tr class="separator:gab87679863646255178427a56dc33e453"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae4836b42b998b336298f3b19dcc9cdeb"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb">xor8</a> (const char *s)</td></tr>
<tr class="memdesc:gae4836b42b998b336298f3b19dcc9cdeb"><td class="mdescLeft">&#160;</td><td class="mdescRight">8-bit XOR algorithm implementation <br /></td></tr>
<tr class="separator:gae4836b42b998b336298f3b19dcc9cdeb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga39d4c16427acbf8bbe744f6d8ed61dc0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#ga39d4c16427acbf8bbe744f6d8ed61dc0">test_xor8</a> ()</td></tr>
<tr class="memdesc:ga39d4c16427acbf8bbe744f6d8ed61dc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test function for <a class="el" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb" title="8-bit XOR algorithm implementation">xor8</a>. <br /></td></tr>
<tr class="separator:ga39d4c16427acbf8bbe744f6d8ed61dc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:ga725275fda6544f05ec52cd3c0599de70"><td class="memItemLeft" align="right" valign="top"><a id="ga725275fda6544f05ec52cd3c0599de70" name="ga725275fda6544f05ec52cd3c0599de70"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>R1</b> = 32</td></tr>
<tr class="memdesc:ga725275fda6544f05ec52cd3c0599de70"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotation constant 1 for mixing function G. <br /></td></tr>
<tr class="separator:ga725275fda6544f05ec52cd3c0599de70"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga636ffdae3b9f1559ae5419320d10a901"><td class="memItemLeft" align="right" valign="top"><a id="ga636ffdae3b9f1559ae5419320d10a901" name="ga636ffdae3b9f1559ae5419320d10a901"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>R2</b> = 24</td></tr>
<tr class="memdesc:ga636ffdae3b9f1559ae5419320d10a901"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotation constant 2 for mixing function G. <br /></td></tr>
<tr class="separator:ga636ffdae3b9f1559ae5419320d10a901"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac1a3efdb45c4a807074d73fb8435144f"><td class="memItemLeft" align="right" valign="top"><a id="gac1a3efdb45c4a807074d73fb8435144f" name="gac1a3efdb45c4a807074d73fb8435144f"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>R3</b> = 16</td></tr>
<tr class="memdesc:gac1a3efdb45c4a807074d73fb8435144f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotation constant 3 for mixing function G. <br /></td></tr>
<tr class="separator:gac1a3efdb45c4a807074d73fb8435144f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf05b277482f6c423d3d2ee7f273e4da1"><td class="memItemLeft" align="right" valign="top"><a id="gaf05b277482f6c423d3d2ee7f273e4da1" name="gaf05b277482f6c423d3d2ee7f273e4da1"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>R4</b> = 63</td></tr>
<tr class="memdesc:gaf05b277482f6c423d3d2ee7f273e4da1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotation constant 4 for mixing function G. <br /></td></tr>
<tr class="separator:gaf05b277482f6c423d3d2ee7f273e4da1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabaac4e8c647ac9882ec38de284382c0b"><td class="memItemLeft" align="right" valign="top">static const uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gabaac4e8c647ac9882ec38de284382c0b">blake2b_iv</a> [8]</td></tr>
<tr class="memdesc:gabaac4e8c647ac9882ec38de284382c0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">BLAKE2b Initialization vector blake2b_iv[i] = floor(2**64 * frac(sqrt(prime(i+1)))), where prime(i) is the i:th prime number. <br /></td></tr>
<tr class="separator:gabaac4e8c647ac9882ec38de284382c0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac97f6ce73af41a0bd4bce78b3f42f6c8"><td class="memItemLeft" align="right" valign="top">static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d3b/group__hash.html#gac97f6ce73af41a0bd4bce78b3f42f6c8">blake2b_sigma</a> [12][16]</td></tr>
<tr class="memdesc:gac97f6ce73af41a0bd4bce78b3f42f6c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">word schedule permutations for each round of the algorithm <br /></td></tr>
<tr class="separator:gac97f6ce73af41a0bd4bce78b3f42f6c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="gafe4fb267f5fd876bc5f069b0a76054e4" name="gafe4fb267f5fd876bc5f069b0a76054e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafe4fb267f5fd876bc5f069b0a76054e4">&#9670;&#160;</a></span>bb</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define bb&#160;&#160;&#160;128</td>
</tr>
</table>
</div><div class="memdoc">
<p>for asserts </p>
<p>for fixed-width integer types e.g. uint64_t and uint8_t for IO for malloc, calloc, and free. As well as size_t</p>
<p>the size of a data block in bytes </p>
</div>
</div>
<a id="gafa6921cfca101af04b9dcc8d29bc7b16" name="gafa6921cfca101af04b9dcc8d29bc7b16"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafa6921cfca101af04b9dcc8d29bc7b16">&#9670;&#160;</a></span>CEIL</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define CEIL</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">a, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">b&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;(((a) / (b)) + ((a) % (b) != 0))</td>
</tr>
</table>
</div><div class="memdoc">
<p>ceiling division macro without floats </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a</td><td>dividend </td></tr>
<tr><td class="paramname">b</td><td>divisor </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gaaf1984a095293c68f7dad2d31790ec3b" name="gaaf1984a095293c68f7dad2d31790ec3b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaaf1984a095293c68f7dad2d31790ec3b">&#9670;&#160;</a></span>U128_ZERO</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define U128_ZERO</td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"> { \</div>
<div class="line"> 0, 0 \</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>zero-value initializer for u128 type </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga506f0227a3b5f9434a503e09a3cb672b" name="ga506f0227a3b5f9434a503e09a3cb672b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga506f0227a3b5f9434a503e09a3cb672b">&#9670;&#160;</a></span>adler32()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t adler32 </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>32-bit Adler algorithm implementation </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>NULL terminated ASCII string to hash </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>32-bit hash result </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 19</span>{</div>
<div class="line"><span class="lineno"> 20</span> uint32_t a = 1;</div>
<div class="line"><span class="lineno"> 21</span> uint32_t b = 0;</div>
<div class="line"><span class="lineno"> 22</span> <span class="keyword">const</span> uint32_t MODADLER = 65521;</div>
<div class="line"><span class="lineno"> 23</span> </div>
<div class="line"><span class="lineno"> 24</span> <span class="keywordtype">size_t</span> i = 0;</div>
<div class="line"><span class="lineno"> 25</span> <span class="keywordflow">while</span> (s[i] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><span class="lineno"> 26</span> {</div>
<div class="line"><span class="lineno"> 27</span> a = (a + s[i]) % MODADLER;</div>
<div class="line"><span class="lineno"> 28</span> b = (b + a) % MODADLER;</div>
<div class="line"><span class="lineno"> 29</span> i++;</div>
<div class="line"><span class="lineno"> 30</span> }</div>
<div class="line"><span class="lineno"> 31</span> <span class="keywordflow">return</span> (b &lt;&lt; 16) | a;</div>
<div class="line"><span class="lineno"> 32</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="gaf2cd4bc8e8097fff865741a0efc42eca" name="gaf2cd4bc8e8097fff865741a0efc42eca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf2cd4bc8e8097fff865741a0efc42eca">&#9670;&#160;</a></span>blake2b()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t * blake2b </td>
<td>(</td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>message</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>kk</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>nn</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>blake2b hash function </p>
<p>This is the front-end function that sets up the argument for <a class="el" href="../../d7/d3b/group__hash.html#gafa42f7c30fb9921ba2eafa8b68b23582" title="driver function to perform the hashing as described in specification">BLAKE2B()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">message</td><td>the message to be hashed </td></tr>
<tr><td class="paramname">len</td><td>length of message (0 &lt;= len &lt; 2**128) (depends on sizeof(size_t) for this implementation) </td></tr>
<tr><td class="paramname">key</td><td>optional secret key </td></tr>
<tr><td class="paramname">kk</td><td>length of optional secret key (0 &lt;= kk &lt;= 64) </td></tr>
<tr><td class="paramname">nn</td><td>length of output digest (1 &lt;= nn &lt; 64)</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>NULL if heap memory couldn't be allocated. Otherwise heap allocated memory nn bytes large </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 356</span>{</div>
<div class="line"><span class="lineno"> 357</span> uint8_t *dest = NULL;</div>
<div class="line"><span class="lineno"> 358</span> uint64_t long_hold;</div>
<div class="line"><span class="lineno"> 359</span> <span class="keywordtype">size_t</span> dd, has_key, i;</div>
<div class="line"><span class="lineno"> 360</span> <span class="keywordtype">size_t</span> block_index, word_in_block;</div>
<div class="line"><span class="lineno"> 361</span> <a class="code hl_typedef" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a> ll;</div>
<div class="line"><span class="lineno"> 362</span> <a class="code hl_typedef" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a> *blocks;</div>
<div class="line"><span class="lineno"> 363</span> </div>
<div class="line"><span class="lineno"> 364</span> <span class="keywordflow">if</span> (message == NULL)</div>
<div class="line"><span class="lineno"> 365</span> {</div>
<div class="line"><span class="lineno"> 366</span> len = 0;</div>
<div class="line"><span class="lineno"> 367</span> }</div>
<div class="line"><span class="lineno"> 368</span> <span class="keywordflow">if</span> (key == NULL)</div>
<div class="line"><span class="lineno"> 369</span> {</div>
<div class="line"><span class="lineno"> 370</span> kk = 0;</div>
<div class="line"><span class="lineno"> 371</span> }</div>
<div class="line"><span class="lineno"> 372</span> </div>
<div class="line"><span class="lineno"> 373</span> kk = <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga3acffbd305ee72dcd4593c0d8af64a4f">MIN</a>(kk, <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga1ee4dc21c835217a5a1dddfb48b43063">KK_MAX</a>);</div>
<div class="line"><span class="lineno"> 374</span> nn = <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga3acffbd305ee72dcd4593c0d8af64a4f">MIN</a>(nn, <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga27e69b76332a4a7e970d2b4e29674cff">NN_MAX</a>);</div>
<div class="line"><span class="lineno"> 375</span> </div>
<div class="line"><span class="lineno"> 376</span> dd = <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafa99ec4acc4ecb2dc3c2d05da15d0e3f">MAX</a>(<a class="code hl_define" href="../../d7/d3b/group__hash.html#gafa6921cfca101af04b9dcc8d29bc7b16">CEIL</a>(kk, <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>) + <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafa6921cfca101af04b9dcc8d29bc7b16">CEIL</a>(len, <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>), 1);</div>
<div class="line"><span class="lineno"> 377</span> </div>
<div class="line"><span class="lineno"> 378</span> blocks = <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#afdddaa949a93c1ef559a638e98f9c21b">calloc</a>(dd, <span class="keyword">sizeof</span>(<a class="code hl_typedef" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a>));</div>
<div class="line"><span class="lineno"> 379</span> <span class="keywordflow">if</span> (blocks == NULL)</div>
<div class="line"><span class="lineno"> 380</span> {</div>
<div class="line"><span class="lineno"> 381</span> <span class="keywordflow">return</span> NULL;</div>
<div class="line"><span class="lineno"> 382</span> }</div>
<div class="line"><span class="lineno"> 383</span> </div>
<div class="line"><span class="lineno"> 384</span> dest = <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a>(nn * <span class="keyword">sizeof</span>(uint8_t));</div>
<div class="line"><span class="lineno"> 385</span> <span class="keywordflow">if</span> (dest == NULL)</div>
<div class="line"><span class="lineno"> 386</span> {</div>
<div class="line"><span class="lineno"> 387</span> <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a>(blocks);</div>
<div class="line"><span class="lineno"> 388</span> <span class="keywordflow">return</span> NULL;</div>
<div class="line"><span class="lineno"> 389</span> }</div>
<div class="line"><span class="lineno"> 390</span> </div>
<div class="line"><span class="lineno"> 391</span> <span class="comment">/* If there is a secret key it occupies the first block */</span></div>
<div class="line"><span class="lineno"> 392</span> <span class="keywordflow">for</span> (i = 0; i &lt; kk; i++)</div>
<div class="line"><span class="lineno"> 393</span> {</div>
<div class="line"><span class="lineno"> 394</span> long_hold = key[i];</div>
<div class="line"><span class="lineno"> 395</span> long_hold &lt;&lt;= 8 * (i % 8);</div>
<div class="line"><span class="lineno"> 396</span> </div>
<div class="line"><span class="lineno"> 397</span> word_in_block = (i % <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>) / 8;</div>
<div class="line"><span class="lineno"> 398</span> <span class="comment">/* block_index will always be 0 because kk &lt;= 64 and bb = 128*/</span></div>
<div class="line"><span class="lineno"> 399</span> blocks[0][word_in_block] |= long_hold;</div>
<div class="line"><span class="lineno"> 400</span> }</div>
<div class="line"><span class="lineno"> 401</span> </div>
<div class="line"><span class="lineno"> 402</span> has_key = kk &gt; 0 ? 1 : 0;</div>
<div class="line"><span class="lineno"> 403</span> </div>
<div class="line"><span class="lineno"> 404</span> <span class="keywordflow">for</span> (i = 0; i &lt; len; i++)</div>
<div class="line"><span class="lineno"> 405</span> {</div>
<div class="line"><span class="lineno"> 406</span> <span class="comment">/* long_hold exists because the bit-shifting will overflow if we don&#39;t</span></div>
<div class="line"><span class="lineno"> 407</span><span class="comment"> * store the value */</span></div>
<div class="line"><span class="lineno"> 408</span> long_hold = message[i];</div>
<div class="line"><span class="lineno"> 409</span> long_hold &lt;&lt;= 8 * (i % 8);</div>
<div class="line"><span class="lineno"> 410</span> </div>
<div class="line"><span class="lineno"> 411</span> block_index = has_key + (i / <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>);</div>
<div class="line"><span class="lineno"> 412</span> word_in_block = (i % <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>) / 8;</div>
<div class="line"><span class="lineno"> 413</span> </div>
<div class="line"><span class="lineno"> 414</span> blocks[block_index][word_in_block] |= long_hold;</div>
<div class="line"><span class="lineno"> 415</span> }</div>
<div class="line"><span class="lineno"> 416</span> </div>
<div class="line"><span class="lineno"> 417</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga94c9f3e74306c2b7ac5f141d8454dbe9">u128_fill</a>(ll, len);</div>
<div class="line"><span class="lineno"> 418</span> </div>
<div class="line"><span class="lineno"> 419</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#gafa42f7c30fb9921ba2eafa8b68b23582">BLAKE2B</a>(dest, blocks, dd, ll, kk, nn);</div>
<div class="line"><span class="lineno"> 420</span> </div>
<div class="line"><span class="lineno"> 421</span> <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a>(blocks);</div>
<div class="line"><span class="lineno"> 422</span> </div>
<div class="line"><span class="lineno"> 423</span> <span class="keywordflow">return</span> dest;</div>
<div class="line"><span class="lineno"> 424</span>}</div>
<div class="ttc" id="agroup__hash_html_ga1ee4dc21c835217a5a1dddfb48b43063"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga1ee4dc21c835217a5a1dddfb48b43063">KK_MAX</a></div><div class="ttdeci">#define KK_MAX</div><div class="ttdoc">max key length for BLAKE2b</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:38</div></div>
<div class="ttc" id="agroup__hash_html_ga27e69b76332a4a7e970d2b4e29674cff"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga27e69b76332a4a7e970d2b4e29674cff">NN_MAX</a></div><div class="ttdeci">#define NN_MAX</div><div class="ttdoc">max length of BLAKE2b digest in bytes</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:43</div></div>
<div class="ttc" id="agroup__hash_html_ga3acffbd305ee72dcd4593c0d8af64a4f"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga3acffbd305ee72dcd4593c0d8af64a4f">MIN</a></div><div class="ttdeci">#define MIN(a, b)</div><div class="ttdoc">returns minimum value</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:56</div></div>
<div class="ttc" id="agroup__hash_html_ga94c9f3e74306c2b7ac5f141d8454dbe9"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga94c9f3e74306c2b7ac5f141d8454dbe9">u128_fill</a></div><div class="ttdeci">static void u128_fill(u128 dest, size_t n)</div><div class="ttdoc">put value of n into dest</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:120</div></div>
<div class="ttc" id="agroup__hash_html_gac7cf56cc7cc7b14ceded8253b45db728"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a></div><div class="ttdeci">uint64_t u128[2]</div><div class="ttdoc">128-bit number represented as two uint64's</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:78</div></div>
<div class="ttc" id="agroup__hash_html_gad587ec486728a1423ca04c21482e0685"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a></div><div class="ttdeci">uint64_t block_t[bb/sizeof(uint64_t)]</div><div class="ttdoc">Padded input block containing bb bytes.</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:81</div></div>
<div class="ttc" id="agroup__hash_html_gafa42f7c30fb9921ba2eafa8b68b23582"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gafa42f7c30fb9921ba2eafa8b68b23582">BLAKE2B</a></div><div class="ttdeci">static int BLAKE2B(uint8_t *dest, block_t *d, size_t dd, u128 ll, uint8_t kk, uint8_t nn)</div><div class="ttdoc">driver function to perform the hashing as described in specification</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:286</div></div>
<div class="ttc" id="agroup__hash_html_gafa6921cfca101af04b9dcc8d29bc7b16"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gafa6921cfca101af04b9dcc8d29bc7b16">CEIL</a></div><div class="ttdeci">#define CEIL(a, b)</div><div class="ttdoc">ceiling division macro without floats</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:51</div></div>
<div class="ttc" id="agroup__hash_html_gafa99ec4acc4ecb2dc3c2d05da15d0e3f"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gafa99ec4acc4ecb2dc3c2d05da15d0e3f">MAX</a></div><div class="ttdeci">#define MAX(a, b)</div><div class="ttdoc">returns maximum value</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:61</div></div>
<div class="ttc" id="agroup__hash_html_gafe4fb267f5fd876bc5f069b0a76054e4"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a></div><div class="ttdeci">#define bb</div><div class="ttdoc">for asserts</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:33</div></div>
<div class="ttc" id="amalloc__dbg_8h_html_a725f50ecaf1959d96de79b36b4788fee"><div class="ttname"><a href="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a></div><div class="ttdeci">#define malloc(bytes)</div><div class="ttdoc">This macro replace the standard malloc function with malloc_dbg.</div><div class="ttdef"><b>Definition</b> malloc_dbg.h:18</div></div>
<div class="ttc" id="amalloc__dbg_8h_html_a9cc854374299a1dd933bf62029761768"><div class="ttname"><a href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a></div><div class="ttdeci">#define free(ptr)</div><div class="ttdoc">This macro replace the standard free function with free_dbg.</div><div class="ttdef"><b>Definition</b> malloc_dbg.h:26</div></div>
<div class="ttc" id="amalloc__dbg_8h_html_afdddaa949a93c1ef559a638e98f9c21b"><div class="ttname"><a href="../../d2/ddd/malloc__dbg_8h.html#afdddaa949a93c1ef559a638e98f9c21b">calloc</a></div><div class="ttdeci">#define calloc(elemCount, elemSize)</div><div class="ttdoc">This macro replace the standard calloc function with calloc_dbg.</div><div class="ttdef"><b>Definition</b> malloc_dbg.h:22</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="../../d7/d3b/group__hash_gaf2cd4bc8e8097fff865741a0efc42eca_cgraph.svg" width="454" height="110"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="gafa42f7c30fb9921ba2eafa8b68b23582" name="gafa42f7c30fb9921ba2eafa8b68b23582"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafa42f7c30fb9921ba2eafa8b68b23582">&#9670;&#160;</a></span>BLAKE2B()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static int BLAKE2B </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>dest</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a> *&#160;</td>
<td class="paramname"><em>d</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>dd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a>&#160;</td>
<td class="paramname"><em>ll</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>kk</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>nn</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></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>driver function to perform the hashing as described in specification </p>
<p>pseudocode: (credit to authors of RFC 7693 listed above) FUNCTION BLAKE2( d[0..dd-1], ll, kk, nn ) | | h[0..7] := IV[0..7] // Initialization <a class="el" href="../../d4/d06/struct_vector.html" title="for IO operations">Vector</a>. | | // Parameter block p[0] | h[0] := h[0] ^ 0x01010000 ^ (kk &lt;&lt; 8) ^ nn | | // Process padded key and data blocks | IF dd &gt; 1 THEN | | FOR i = 0 TO dd - 2 DO | | | h := F( h, d[i], (i + 1) * bb, FALSE ) | | END FOR. | END IF. | | // Final block. | IF kk = 0 THEN | | h := F( h, d[dd - 1], ll, TRUE ) | ELSE | | h := F( h, d[dd - 1], ll + bb, TRUE ) | END IF. | | RETURN first "nn" bytes from little-endian word array h[]. | END FUNCTION.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dest</td><td>destination of hashing digest </td></tr>
<tr><td class="paramname">d</td><td>message blocks </td></tr>
<tr><td class="paramname">dd</td><td>length of d </td></tr>
<tr><td class="paramname">ll</td><td>128-bit length of message </td></tr>
<tr><td class="paramname">kk</td><td>length of secret key </td></tr>
<tr><td class="paramname">nn</td><td>length of hash digest</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 upon successful hash </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 288</span>{</div>
<div class="line"><span class="lineno"> 289</span> uint8_t bytes[8];</div>
<div class="line"><span class="lineno"> 290</span> uint64_t i, j;</div>
<div class="line"><span class="lineno"> 291</span> uint64_t h[8];</div>
<div class="line"><span class="lineno"> 292</span> <a class="code hl_typedef" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a> t = <a class="code hl_define" href="../../d7/d3b/group__hash.html#gaaf1984a095293c68f7dad2d31790ec3b">U128_ZERO</a>;</div>
<div class="line"><span class="lineno"> 293</span> </div>
<div class="line"><span class="lineno"> 294</span> <span class="comment">/* h[0..7] = IV[0..7] */</span></div>
<div class="line"><span class="lineno"> 295</span> <span class="keywordflow">for</span> (i = 0; i &lt; 8; i++)</div>
<div class="line"><span class="lineno"> 296</span> {</div>
<div class="line"><span class="lineno"> 297</span> h[i] = <a class="code hl_variable" href="../../d7/d3b/group__hash.html#gabaac4e8c647ac9882ec38de284382c0b">blake2b_iv</a>[i];</div>
<div class="line"><span class="lineno"> 298</span> }</div>
<div class="line"><span class="lineno"> 299</span> </div>
<div class="line"><span class="lineno"> 300</span> h[0] ^= 0x01010000 ^ (kk &lt;&lt; 8) ^ nn;</div>
<div class="line"><span class="lineno"> 301</span> </div>
<div class="line"><span class="lineno"> 302</span> <span class="keywordflow">if</span> (dd &gt; 1)</div>
<div class="line"><span class="lineno"> 303</span> {</div>
<div class="line"><span class="lineno"> 304</span> <span class="keywordflow">for</span> (i = 0; i &lt; dd - 1; i++)</div>
<div class="line"><span class="lineno"> 305</span> {</div>
<div class="line"><span class="lineno"> 306</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#gaead2e4f50d0c512905c07ddd564e082e">u128_increment</a>(t, <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>);</div>
<div class="line"><span class="lineno"> 307</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga37e02cbf2df2247d31ab92f443990dbd">F</a>(h, d[i], t, 0);</div>
<div class="line"><span class="lineno"> 308</span> }</div>
<div class="line"><span class="lineno"> 309</span> }</div>
<div class="line"><span class="lineno"> 310</span> </div>
<div class="line"><span class="lineno"> 311</span> <span class="keywordflow">if</span> (kk != 0)</div>
<div class="line"><span class="lineno"> 312</span> {</div>
<div class="line"><span class="lineno"> 313</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#gaead2e4f50d0c512905c07ddd564e082e">u128_increment</a>(ll, <a class="code hl_define" href="../../d7/d3b/group__hash.html#gafe4fb267f5fd876bc5f069b0a76054e4">bb</a>);</div>
<div class="line"><span class="lineno"> 314</span> }</div>
<div class="line"><span class="lineno"> 315</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga37e02cbf2df2247d31ab92f443990dbd">F</a>(h, d[dd - 1], ll, 1);</div>
<div class="line"><span class="lineno"> 316</span> </div>
<div class="line"><span class="lineno"> 317</span> <span class="comment">/* copy bytes from h to destination buffer */</span></div>
<div class="line"><span class="lineno"> 318</span> <span class="keywordflow">for</span> (i = 0; i &lt; nn; i++)</div>
<div class="line"><span class="lineno"> 319</span> {</div>
<div class="line"><span class="lineno"> 320</span> <span class="keywordflow">if</span> (i % <span class="keyword">sizeof</span>(uint64_t) == 0)</div>
<div class="line"><span class="lineno"> 321</span> {</div>
<div class="line"><span class="lineno"> 322</span> <span class="comment">/* copy values from uint64 to 8 u8&#39;s */</span></div>
<div class="line"><span class="lineno"> 323</span> <span class="keywordflow">for</span> (j = 0; j &lt; <span class="keyword">sizeof</span>(uint64_t); j++)</div>
<div class="line"><span class="lineno"> 324</span> {</div>
<div class="line"><span class="lineno"> 325</span> uint16_t offset = 8 * j;</div>
<div class="line"><span class="lineno"> 326</span> uint64_t mask = 0xFF;</div>
<div class="line"><span class="lineno"> 327</span> mask &lt;&lt;= offset;</div>
<div class="line"><span class="lineno"> 328</span> </div>
<div class="line"><span class="lineno"> 329</span> bytes[j] = (h[i / 8] &amp; (mask)) &gt;&gt; offset;</div>
<div class="line"><span class="lineno"> 330</span> }</div>
<div class="line"><span class="lineno"> 331</span> }</div>
<div class="line"><span class="lineno"> 332</span> </div>
<div class="line"><span class="lineno"> 333</span> dest[i] = bytes[i % 8];</div>
<div class="line"><span class="lineno"> 334</span> }</div>
<div class="line"><span class="lineno"> 335</span> </div>
<div class="line"><span class="lineno"> 336</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 337</span>}</div>
<div class="ttc" id="agroup__hash_html_ga37e02cbf2df2247d31ab92f443990dbd"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga37e02cbf2df2247d31ab92f443990dbd">F</a></div><div class="ttdeci">static void F(uint64_t h[8], block_t m, u128 t, int f)</div><div class="ttdoc">compression function F</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:203</div></div>
<div class="ttc" id="agroup__hash_html_gaaf1984a095293c68f7dad2d31790ec3b"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gaaf1984a095293c68f7dad2d31790ec3b">U128_ZERO</a></div><div class="ttdeci">#define U128_ZERO</div><div class="ttdoc">zero-value initializer for u128 type</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:72</div></div>
<div class="ttc" id="agroup__hash_html_gabaac4e8c647ac9882ec38de284382c0b"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gabaac4e8c647ac9882ec38de284382c0b">blake2b_iv</a></div><div class="ttdeci">static const uint64_t blake2b_iv[8]</div><div class="ttdoc">BLAKE2b Initialization vector blake2b_iv[i] = floor(2**64 * frac(sqrt(prime(i+1)))),...</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:88</div></div>
<div class="ttc" id="agroup__hash_html_gaead2e4f50d0c512905c07ddd564e082e"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gaead2e4f50d0c512905c07ddd564e082e">u128_increment</a></div><div class="ttdeci">static void u128_increment(u128 dest, uint64_t n)</div><div class="ttdoc">increment an 128-bit number by a given amount</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:147</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="../../d7/d3b/group__hash_gafa42f7c30fb9921ba2eafa8b68b23582_cgraph.svg" width="339" 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>
</div>
<a id="ga483e7ee6db1dc09a0f3e683e028ec567" name="ga483e7ee6db1dc09a0f3e683e028ec567"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga483e7ee6db1dc09a0f3e683e028ec567">&#9670;&#160;</a></span>crc32()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t crc32 </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>32-bit CRC algorithm implementation </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>NULL terminated ASCII string to hash </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>32-bit hash result </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 21</span>{</div>
<div class="line"><span class="lineno"> 22</span> uint32_t crc = 0xffffffff;</div>
<div class="line"><span class="lineno"> 23</span> <span class="keywordtype">size_t</span> i = 0;</div>
<div class="line"><span class="lineno"> 24</span> <span class="keywordflow">while</span> (s[i] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><span class="lineno"> 25</span> {</div>
<div class="line"><span class="lineno"> 26</span> uint8_t <span class="keywordtype">byte</span> = s[i];</div>
<div class="line"><span class="lineno"> 27</span> crc = crc ^ byte;</div>
<div class="line"><span class="lineno"> 28</span> <span class="keywordflow">for</span> (uint8_t j = 8; j &gt; 0; --j)</div>
<div class="line"><span class="lineno"> 29</span> {</div>
<div class="line"><span class="lineno"> 30</span> crc = (crc &gt;&gt; 1) ^ (0xEDB88320 &amp; (-(crc &amp; 1)));</div>
<div class="line"><span class="lineno"> 31</span> }</div>
<div class="line"><span class="lineno"> 32</span> </div>
<div class="line"><span class="lineno"> 33</span> i++;</div>
<div class="line"><span class="lineno"> 34</span> }</div>
<div class="line"><span class="lineno"> 35</span> <span class="keywordflow">return</span> crc ^ 0xffffffff;</div>
<div class="line"><span class="lineno"> 36</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ga1ac362fa25f7c35d104205985f8e754b" name="ga1ac362fa25f7c35d104205985f8e754b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1ac362fa25f7c35d104205985f8e754b">&#9670;&#160;</a></span>djb2()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t djb2 </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>DJB2 algorithm implementation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>NULL terminated string to hash </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>64-bit hash result </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 19</span>{</div>
<div class="line"><span class="lineno"> 20</span> uint64_t hash = 5381; <span class="comment">/* init value */</span></div>
<div class="line"><span class="lineno"> 21</span> <span class="keywordtype">size_t</span> i = 0;</div>
<div class="line"><span class="lineno"> 22</span> <span class="keywordflow">while</span> (s[i] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><span class="lineno"> 23</span> {</div>
<div class="line"><span class="lineno"> 24</span> hash = ((hash &lt;&lt; 5) + hash) + s[i];</div>
<div class="line"><span class="lineno"> 25</span> i++;</div>
<div class="line"><span class="lineno"> 26</span> }</div>
<div class="line"><span class="lineno"> 27</span> <span class="keywordflow">return</span> hash;</div>
<div class="line"><span class="lineno"> 28</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ga37e02cbf2df2247d31ab92f443990dbd" name="ga37e02cbf2df2247d31ab92f443990dbd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga37e02cbf2df2247d31ab92f443990dbd">&#9670;&#160;</a></span>F()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void F </td>
<td>(</td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>h</em>[8], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a>&#160;</td>
<td class="paramname"><em>m</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a>&#160;</td>
<td class="paramname"><em>t</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>f</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></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>compression function F </p>
<p>Securely mixes the values in block m into the state vector h. Value at v[14] is also inverted if this is the final block to be compressed.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">h</td><td>the state vector </td></tr>
<tr><td class="paramname">m</td><td>message vector to be compressed into h </td></tr>
<tr><td class="paramname">t</td><td>128-bit offset counter </td></tr>
<tr><td class="paramname">f</td><td>flag to indicate whether this is the final block</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 204</span>{</div>
<div class="line"><span class="lineno"> 205</span> <span class="keywordtype">int</span> i;</div>
<div class="line"><span class="lineno"> 206</span> <a class="code hl_typedef" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a> v;</div>
<div class="line"><span class="lineno"> 207</span> </div>
<div class="line"><span class="lineno"> 208</span> <span class="comment">/* v[0..7] := h[0..7] */</span></div>
<div class="line"><span class="lineno"> 209</span> <span class="keywordflow">for</span> (i = 0; i &lt; 8; i++)</div>
<div class="line"><span class="lineno"> 210</span> {</div>
<div class="line"><span class="lineno"> 211</span> v[i] = h[i];</div>
<div class="line"><span class="lineno"> 212</span> }</div>
<div class="line"><span class="lineno"> 213</span> <span class="comment">/* v[8..15] := IV[0..7] */</span></div>
<div class="line"><span class="lineno"> 214</span> <span class="keywordflow">for</span> (; i &lt; 16; i++)</div>
<div class="line"><span class="lineno"> 215</span> {</div>
<div class="line"><span class="lineno"> 216</span> v[i] = <a class="code hl_variable" href="../../d7/d3b/group__hash.html#gabaac4e8c647ac9882ec38de284382c0b">blake2b_iv</a>[i - 8];</div>
<div class="line"><span class="lineno"> 217</span> }</div>
<div class="line"><span class="lineno"> 218</span> </div>
<div class="line"><span class="lineno"> 219</span> v[12] ^= t[0]; <span class="comment">/* v[12] ^ (t mod 2**w) */</span></div>
<div class="line"><span class="lineno"> 220</span> v[13] ^= t[1]; <span class="comment">/* v[13] ^ (t &gt;&gt; w) */</span></div>
<div class="line"><span class="lineno"> 221</span> </div>
<div class="line"><span class="lineno"> 222</span> <span class="keywordflow">if</span> (f)</div>
<div class="line"><span class="lineno"> 223</span> {</div>
<div class="line"><span class="lineno"> 224</span> v[14] = ~v[14];</div>
<div class="line"><span class="lineno"> 225</span> }</div>
<div class="line"><span class="lineno"> 226</span> </div>
<div class="line"><span class="lineno"> 227</span> <span class="keywordflow">for</span> (i = 0; i &lt; 12; i++)</div>
<div class="line"><span class="lineno"> 228</span> {</div>
<div class="line"><span class="lineno"> 229</span> <span class="keyword">const</span> uint8_t *s = <a class="code hl_variable" href="../../d7/d3b/group__hash.html#gac97f6ce73af41a0bd4bce78b3f42f6c8">blake2b_sigma</a>[i];</div>
<div class="line"><span class="lineno"> 230</span> </div>
<div class="line"><span class="lineno"> 231</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 0, 4, 8, 12, m[s[0]], m[s[1]]);</div>
<div class="line"><span class="lineno"> 232</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 1, 5, 9, 13, m[s[2]], m[s[3]]);</div>
<div class="line"><span class="lineno"> 233</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 2, 6, 10, 14, m[s[4]], m[s[5]]);</div>
<div class="line"><span class="lineno"> 234</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 3, 7, 11, 15, m[s[6]], m[s[7]]);</div>
<div class="line"><span class="lineno"> 235</span> </div>
<div class="line"><span class="lineno"> 236</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 0, 5, 10, 15, m[s[8]], m[s[9]]);</div>
<div class="line"><span class="lineno"> 237</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 1, 6, 11, 12, m[s[10]], m[s[11]]);</div>
<div class="line"><span class="lineno"> 238</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 2, 7, 8, 13, m[s[12]], m[s[13]]);</div>
<div class="line"><span class="lineno"> 239</span> <a class="code hl_function" href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a>(v, 3, 4, 9, 14, m[s[14]], m[s[15]]);</div>
<div class="line"><span class="lineno"> 240</span> }</div>
<div class="line"><span class="lineno"> 241</span> </div>
<div class="line"><span class="lineno"> 242</span> <span class="keywordflow">for</span> (i = 0; i &lt; 8; i++)</div>
<div class="line"><span class="lineno"> 243</span> {</div>
<div class="line"><span class="lineno"> 244</span> h[i] ^= v[i] ^ v[i + 8];</div>
<div class="line"><span class="lineno"> 245</span> }</div>
<div class="line"><span class="lineno"> 246</span>}</div>
<div class="ttc" id="agroup__hash_html_ga049d44b5a4804ca5a1b7a290f3fa3202"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga049d44b5a4804ca5a1b7a290f3fa3202">G</a></div><div class="ttdeci">static void G(block_t v, uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint64_t x, uint64_t y)</div><div class="ttdoc">blake2b mixing function G</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:175</div></div>
<div class="ttc" id="agroup__hash_html_gac97f6ce73af41a0bd4bce78b3f42f6c8"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gac97f6ce73af41a0bd4bce78b3f42f6c8">blake2b_sigma</a></div><div class="ttdeci">static const uint8_t blake2b_sigma[12][16]</div><div class="ttdoc">word schedule permutations for each round of the algorithm</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:97</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="../../d7/d3b/group__hash_ga37e02cbf2df2247d31ab92f443990dbd_cgraph.svg" width="136" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="ga049d44b5a4804ca5a1b7a290f3fa3202" name="ga049d44b5a4804ca5a1b7a290f3fa3202"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga049d44b5a4804ca5a1b7a290f3fa3202">&#9670;&#160;</a></span>G()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void G </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gad587ec486728a1423ca04c21482e0685">block_t</a>&#160;</td>
<td class="paramname"><em>v</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>c</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>d</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>y</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></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>blake2b mixing function G </p>
<p>Shuffles values in block v depending on provided indeces a, b, c, and d. x and y are also mixed into the block.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">v</td><td>array of words to be mixed </td></tr>
<tr><td class="paramname">a</td><td>first index </td></tr>
<tr><td class="paramname">b</td><td>second index </td></tr>
<tr><td class="paramname">c</td><td>third index </td></tr>
<tr><td class="paramname">d</td><td>fourth index </td></tr>
<tr><td class="paramname">x</td><td>first word being mixed into v </td></tr>
<tr><td class="paramname">y</td><td>second word being mixed into y</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 177</span>{</div>
<div class="line"><span class="lineno"> 178</span> v[a] += v[b] + x;</div>
<div class="line"><span class="lineno"> 179</span> v[d] = <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga1293f9b91cd85591875a9453ba71f1a3">ROTR64</a>(v[d] ^ v[a], <a class="code hl_variable" href="../../d7/d3b/group__hash.html#ga725275fda6544f05ec52cd3c0599de70">R1</a>);</div>
<div class="line"><span class="lineno"> 180</span> v[c] += v[d];</div>
<div class="line"><span class="lineno"> 181</span> v[b] = <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga1293f9b91cd85591875a9453ba71f1a3">ROTR64</a>(v[b] ^ v[c], <a class="code hl_variable" href="../../d7/d3b/group__hash.html#ga636ffdae3b9f1559ae5419320d10a901">R2</a>);</div>
<div class="line"><span class="lineno"> 182</span> v[a] += v[b] + y;</div>
<div class="line"><span class="lineno"> 183</span> v[d] = <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga1293f9b91cd85591875a9453ba71f1a3">ROTR64</a>(v[d] ^ v[a], <a class="code hl_variable" href="../../d7/d3b/group__hash.html#gac1a3efdb45c4a807074d73fb8435144f">R3</a>);</div>
<div class="line"><span class="lineno"> 184</span> v[c] += v[d];</div>
<div class="line"><span class="lineno"> 185</span> v[b] = <a class="code hl_define" href="../../d7/d3b/group__hash.html#ga1293f9b91cd85591875a9453ba71f1a3">ROTR64</a>(v[b] ^ v[c], <a class="code hl_variable" href="../../d7/d3b/group__hash.html#gaf05b277482f6c423d3d2ee7f273e4da1">R4</a>);</div>
<div class="line"><span class="lineno"> 186</span>}</div>
<div class="ttc" id="agroup__hash_html_ga1293f9b91cd85591875a9453ba71f1a3"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga1293f9b91cd85591875a9453ba71f1a3">ROTR64</a></div><div class="ttdeci">#define ROTR64(n, offset)</div><div class="ttdoc">macro to rotate 64-bit ints to the right Ripped from RFC 7693</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:67</div></div>
<div class="ttc" id="agroup__hash_html_ga636ffdae3b9f1559ae5419320d10a901"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga636ffdae3b9f1559ae5419320d10a901">R2</a></div><div class="ttdeci">static const uint8_t R2</div><div class="ttdoc">Rotation constant 2 for mixing function G.</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:84</div></div>
<div class="ttc" id="agroup__hash_html_ga725275fda6544f05ec52cd3c0599de70"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga725275fda6544f05ec52cd3c0599de70">R1</a></div><div class="ttdeci">static const uint8_t R1</div><div class="ttdoc">Rotation constant 1 for mixing function G.</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:83</div></div>
<div class="ttc" id="agroup__hash_html_gac1a3efdb45c4a807074d73fb8435144f"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gac1a3efdb45c4a807074d73fb8435144f">R3</a></div><div class="ttdeci">static const uint8_t R3</div><div class="ttdoc">Rotation constant 3 for mixing function G.</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:85</div></div>
<div class="ttc" id="agroup__hash_html_gaf05b277482f6c423d3d2ee7f273e4da1"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gaf05b277482f6c423d3d2ee7f273e4da1">R4</a></div><div class="ttdeci">static const uint8_t R4</div><div class="ttdoc">Rotation constant 4 for mixing function G.</div><div class="ttdef"><b>Definition</b> hash_blake2b.c:86</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ga8ab8eeb35f8ccfcad89091b5fdd4f605" name="ga8ab8eeb35f8ccfcad89091b5fdd4f605"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8ab8eeb35f8ccfcad89091b5fdd4f605">&#9670;&#160;</a></span>sdbm()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t sdbm </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>SDBM algorithm implementation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>NULL terminated string to hash </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>64-bit hash result </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 19</span>{</div>
<div class="line"><span class="lineno"> 20</span> uint64_t hash = 0;</div>
<div class="line"><span class="lineno"> 21</span> <span class="keywordtype">size_t</span> i = 0;</div>
<div class="line"><span class="lineno"> 22</span> <span class="keywordflow">while</span> (s[i] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><span class="lineno"> 23</span> {</div>
<div class="line"><span class="lineno"> 24</span> hash = s[i] + (hash &lt;&lt; 6) + (hash &lt;&lt; 16) - hash;</div>
<div class="line"><span class="lineno"> 25</span> i++;</div>
<div class="line"><span class="lineno"> 26</span> }</div>
<div class="line"><span class="lineno"> 27</span> <span class="keywordflow">return</span> hash;</div>
<div class="line"><span class="lineno"> 28</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ga994ea8b243b6c0fbef734551ec5765dd" name="ga994ea8b243b6c0fbef734551ec5765dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga994ea8b243b6c0fbef734551ec5765dd">&#9670;&#160;</a></span>test_adler32()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void test_adler32 </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b" title="32-bit Adler algorithm implementation">adler32</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 39</span>{</div>
<div class="line"><span class="lineno"> 40</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b">adler32</a>(<span class="stringliteral">&quot;Hello World&quot;</span>) == 403375133);</div>
<div class="line"><span class="lineno"> 41</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b">adler32</a>(<span class="stringliteral">&quot;Hello World!&quot;</span>) == 474547262);</div>
<div class="line"><span class="lineno"> 42</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b">adler32</a>(<span class="stringliteral">&quot;Hello world&quot;</span>) == 413860925);</div>
<div class="line"><span class="lineno"> 43</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b">adler32</a>(<span class="stringliteral">&quot;Hello world!&quot;</span>) == 487130206);</div>
<div class="line"><span class="lineno"> 44</span> printf(<span class="stringliteral">&quot;Tests passed\n&quot;</span>);</div>
<div class="line"><span class="lineno"> 45</span>}</div>
<div class="ttc" id="agroup__hash_html_ga506f0227a3b5f9434a503e09a3cb672b"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga506f0227a3b5f9434a503e09a3cb672b">adler32</a></div><div class="ttdeci">uint32_t adler32(const char *s)</div><div class="ttdoc">32-bit Adler algorithm implementation</div><div class="ttdef"><b>Definition</b> hash_adler32.c:18</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="../../d7/d3b/group__hash_ga994ea8b243b6c0fbef734551ec5765dd_cgraph.svg" width="215" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="gad451622bbdca271edfa8e0d98ca422f2" name="gad451622bbdca271edfa8e0d98ca422f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad451622bbdca271edfa8e0d98ca422f2">&#9670;&#160;</a></span>test_crc32()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void test_crc32 </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567" title="32-bit CRC algorithm implementation">crc32</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 43</span>{</div>
<div class="line"><span class="lineno"> 44</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567">crc32</a>(<span class="stringliteral">&quot;Hello World&quot;</span>) == 1243066710);</div>
<div class="line"><span class="lineno"> 45</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567">crc32</a>(<span class="stringliteral">&quot;Hello World!&quot;</span>) == 472456355);</div>
<div class="line"><span class="lineno"> 46</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567">crc32</a>(<span class="stringliteral">&quot;Hello world&quot;</span>) == 2346098258);</div>
<div class="line"><span class="lineno"> 47</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567">crc32</a>(<span class="stringliteral">&quot;Hello world!&quot;</span>) == 461707669);</div>
<div class="line"><span class="lineno"> 48</span> printf(<span class="stringliteral">&quot;Tests passed\n&quot;</span>);</div>
<div class="line"><span class="lineno"> 49</span>}</div>
<div class="ttc" id="agroup__hash_html_ga483e7ee6db1dc09a0f3e683e028ec567"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga483e7ee6db1dc09a0f3e683e028ec567">crc32</a></div><div class="ttdeci">uint32_t crc32(const char *s)</div><div class="ttdoc">32-bit CRC algorithm implementation</div><div class="ttdef"><b>Definition</b> hash_crc32.c:20</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="../../d7/d3b/group__hash_gad451622bbdca271edfa8e0d98ca422f2_cgraph.svg" width="195" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="ga9f76001544014905468dc812336110d5" name="ga9f76001544014905468dc812336110d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9f76001544014905468dc812336110d5">&#9670;&#160;</a></span>test_djb2()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void test_djb2 </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b" title="DJB2 algorithm implementation.">djb2</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 35</span>{</div>
<div class="line"><span class="lineno"> 36</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b">djb2</a>(<span class="stringliteral">&quot;Hello World&quot;</span>) == 13827776004929097857);</div>
<div class="line"><span class="lineno"> 37</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b">djb2</a>(<span class="stringliteral">&quot;Hello World!&quot;</span>) == 13594750393630990530);</div>
<div class="line"><span class="lineno"> 38</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b">djb2</a>(<span class="stringliteral">&quot;Hello world&quot;</span>) == 13827776004967047329);</div>
<div class="line"><span class="lineno"> 39</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b">djb2</a>(<span class="stringliteral">&quot;Hello world!&quot;</span>) == 13594750394883323106);</div>
<div class="line"><span class="lineno"> 40</span> printf(<span class="stringliteral">&quot;Tests passed\n&quot;</span>);</div>
<div class="line"><span class="lineno"> 41</span>}</div>
<div class="ttc" id="agroup__hash_html_ga1ac362fa25f7c35d104205985f8e754b"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga1ac362fa25f7c35d104205985f8e754b">djb2</a></div><div class="ttdeci">uint64_t djb2(const char *s)</div><div class="ttdoc">DJB2 algorithm implementation.</div><div class="ttdef"><b>Definition</b> hash_djb2.c:18</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="../../d7/d3b/group__hash_ga9f76001544014905468dc812336110d5_cgraph.svg" width="179" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="gab87679863646255178427a56dc33e453" name="gab87679863646255178427a56dc33e453"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab87679863646255178427a56dc33e453">&#9670;&#160;</a></span>test_sdbm()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void test_sdbm </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test function for <a class="el" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605" title="SDBM algorithm implementation.">sdbm</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 35</span>{</div>
<div class="line"><span class="lineno"> 36</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605">sdbm</a>(<span class="stringliteral">&quot;Hello World&quot;</span>) == 12881824461405877380U);</div>
<div class="line"><span class="lineno"> 37</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605">sdbm</a>(<span class="stringliteral">&quot;Hello World!&quot;</span>) == 7903571203300273309);</div>
<div class="line"><span class="lineno"> 38</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605">sdbm</a>(<span class="stringliteral">&quot;Hello world&quot;</span>) == 15154913742888948900U);</div>
<div class="line"><span class="lineno"> 39</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605">sdbm</a>(<span class="stringliteral">&quot;Hello world!&quot;</span>) == 15254999417003201661U);</div>
<div class="line"><span class="lineno"> 40</span> printf(<span class="stringliteral">&quot;Tests passed\n&quot;</span>);</div>
<div class="line"><span class="lineno"> 41</span>}</div>
<div class="ttc" id="agroup__hash_html_ga8ab8eeb35f8ccfcad89091b5fdd4f605"><div class="ttname"><a href="../../d7/d3b/group__hash.html#ga8ab8eeb35f8ccfcad89091b5fdd4f605">sdbm</a></div><div class="ttdeci">uint64_t sdbm(const char *s)</div><div class="ttdoc">SDBM algorithm implementation.</div><div class="ttdef"><b>Definition</b> hash_sdbm.c:18</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="../../d7/d3b/group__hash_gab87679863646255178427a56dc33e453_cgraph.svg" width="195" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="ga39d4c16427acbf8bbe744f6d8ed61dc0" name="ga39d4c16427acbf8bbe744f6d8ed61dc0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga39d4c16427acbf8bbe744f6d8ed61dc0">&#9670;&#160;</a></span>test_xor8()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void test_xor8 </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test function for <a class="el" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb" title="8-bit XOR algorithm implementation">xor8</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 36</span>{</div>
<div class="line"><span class="lineno"> 37</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb">xor8</a>(<span class="stringliteral">&quot;Hello World&quot;</span>) == 228);</div>
<div class="line"><span class="lineno"> 38</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb">xor8</a>(<span class="stringliteral">&quot;Hello World!&quot;</span>) == 195);</div>
<div class="line"><span class="lineno"> 39</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb">xor8</a>(<span class="stringliteral">&quot;Hello world&quot;</span>) == 196);</div>
<div class="line"><span class="lineno"> 40</span> assert(<a class="code hl_function" href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb">xor8</a>(<span class="stringliteral">&quot;Hello world!&quot;</span>) == 163);</div>
<div class="line"><span class="lineno"> 41</span> printf(<span class="stringliteral">&quot;Tests passed\n&quot;</span>);</div>
<div class="line"><span class="lineno"> 42</span>}</div>
<div class="ttc" id="agroup__hash_html_gae4836b42b998b336298f3b19dcc9cdeb"><div class="ttname"><a href="../../d7/d3b/group__hash.html#gae4836b42b998b336298f3b19dcc9cdeb">xor8</a></div><div class="ttdeci">uint8_t xor8(const char *s)</div><div class="ttdoc">8-bit XOR algorithm implementation</div><div class="ttdef"><b>Definition</b> hash_xor8.c:19</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="../../d7/d3b/group__hash_ga39d4c16427acbf8bbe744f6d8ed61dc0_cgraph.svg" width="180" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="ga94c9f3e74306c2b7ac5f141d8454dbe9" name="ga94c9f3e74306c2b7ac5f141d8454dbe9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga94c9f3e74306c2b7ac5f141d8454dbe9">&#9670;&#160;</a></span>u128_fill()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void u128_fill </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a>&#160;</td>
<td class="paramname"><em>dest</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>put value of n into dest </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dest</td><td>128-bit number to get copied from n </td></tr>
<tr><td class="paramname">n</td><td>value put into dest</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 121</span>{</div>
<div class="line"><span class="lineno"> 122</span> dest[0] = n &amp; UINT64_MAX;</div>
<div class="line"><span class="lineno"> 123</span> </div>
<div class="line"><span class="lineno"> 124</span> <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(n) &gt; 8)</div>
<div class="line"><span class="lineno"> 125</span> {</div>
<div class="line"><span class="lineno"> 126</span> <span class="comment">/* The C standard does not specify a maximum length for size_t,</span></div>
<div class="line"><span class="lineno"> 127</span><span class="comment"> * although most machines implement it to be the same length as</span></div>
<div class="line"><span class="lineno"> 128</span><span class="comment"> * uint64_t. On machines where size_t is 8 bytes long this will issue a</span></div>
<div class="line"><span class="lineno"> 129</span><span class="comment"> * compiler warning, which is why it is suppressed. But on a machine</span></div>
<div class="line"><span class="lineno"> 130</span><span class="comment"> * where size_t is greater than 8 bytes, this will work as normal. */</span></div>
<div class="line"><span class="lineno"> 131</span> dest[1] = n &gt;&gt; 64;</div>
<div class="line"><span class="lineno"> 132</span> }</div>
<div class="line"><span class="lineno"> 133</span> <span class="keywordflow">else</span></div>
<div class="line"><span class="lineno"> 134</span> {</div>
<div class="line"><span class="lineno"> 135</span> dest[1] = 0;</div>
<div class="line"><span class="lineno"> 136</span> }</div>
<div class="line"><span class="lineno"> 137</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="gaead2e4f50d0c512905c07ddd564e082e" name="gaead2e4f50d0c512905c07ddd564e082e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaead2e4f50d0c512905c07ddd564e082e">&#9670;&#160;</a></span>u128_increment()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void u128_increment </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d7/d3b/group__hash.html#gac7cf56cc7cc7b14ceded8253b45db728">u128</a>&#160;</td>
<td class="paramname"><em>dest</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>increment an 128-bit number by a given amount </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dest</td><td>the value being incremented </td></tr>
<tr><td class="paramname">n</td><td>what dest is being increased by</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 148</span>{</div>
<div class="line"><span class="lineno"> 149</span> <span class="comment">/* Check for overflow */</span></div>
<div class="line"><span class="lineno"> 150</span> <span class="keywordflow">if</span> (UINT64_MAX - dest[0] &lt;= n)</div>
<div class="line"><span class="lineno"> 151</span> {</div>
<div class="line"><span class="lineno"> 152</span> dest[1]++;</div>
<div class="line"><span class="lineno"> 153</span> }</div>
<div class="line"><span class="lineno"> 154</span> </div>
<div class="line"><span class="lineno"> 155</span> dest[0] += n;</div>
<div class="line"><span class="lineno"> 156</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="gae4836b42b998b336298f3b19dcc9cdeb" name="gae4836b42b998b336298f3b19dcc9cdeb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae4836b42b998b336298f3b19dcc9cdeb">&#9670;&#160;</a></span>xor8()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t xor8 </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>8-bit XOR algorithm implementation </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>NULL terminated ASCII string to hash </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>8-bit hash result </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 20</span>{</div>
<div class="line"><span class="lineno"> 21</span> uint8_t hash = 0;</div>
<div class="line"><span class="lineno"> 22</span> <span class="keywordtype">size_t</span> i = 0;</div>
<div class="line"><span class="lineno"> 23</span> <span class="keywordflow">while</span> (s[i] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><span class="lineno"> 24</span> {</div>
<div class="line"><span class="lineno"> 25</span> hash = (hash + s[i]) &amp; 0xff;</div>
<div class="line"><span class="lineno"> 26</span> i++;</div>
<div class="line"><span class="lineno"> 27</span> }</div>
<div class="line"><span class="lineno"> 28</span> <span class="keywordflow">return</span> (((hash ^ 0xff) + 1) &amp; 0xff);</div>
<div class="line"><span class="lineno"> 29</span>}</div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="gabaac4e8c647ac9882ec38de284382c0b" name="gabaac4e8c647ac9882ec38de284382c0b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabaac4e8c647ac9882ec38de284382c0b">&#9670;&#160;</a></span>blake2b_iv</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const uint64_t blake2b_iv[8]</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, 0x3C6EF372FE94F82B,</div>
<div class="line"> 0xA54FF53A5F1D36F1, 0x510E527FADE682D1, 0x9B05688C2B3E6C1F,</div>
<div class="line"> 0x1F83D9ABFB41BD6B, 0x5BE0CD19137E2179}</div>
</div><!-- fragment -->
<p>BLAKE2b Initialization vector blake2b_iv[i] = floor(2**64 * frac(sqrt(prime(i+1)))), where prime(i) is the i:th prime number. </p>
</div>
</div>
<a id="gac97f6ce73af41a0bd4bce78b3f42f6c8" name="gac97f6ce73af41a0bd4bce78b3f42f6c8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac97f6ce73af41a0bd4bce78b3f42f6c8">&#9670;&#160;</a></span>blake2b_sigma</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const uint8_t blake2b_sigma[12][16]</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},</div>
<div class="line"> {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},</div>
<div class="line"> {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},</div>
<div class="line"> {7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},</div>
<div class="line"> {9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},</div>
<div class="line"> {2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},</div>
<div class="line"> {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},</div>
<div class="line"> {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},</div>
<div class="line"> {6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},</div>
<div class="line"> {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0},</div>
<div class="line"> {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},</div>
<div class="line"> {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5,</div>
<div class="line"> 3}}</div>
</div><!-- fragment -->
<p>word schedule permutations for each round of the algorithm </p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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.9.7 </li>
</ul>
</div>
</body>
</html>