mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
516 lines
35 KiB
HTML
516 lines
35 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.6"/>
|
|
<title>Arduino Cryptography Library: XOF Class Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">Arduino Cryptography Library
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.6 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Pages</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classXOF-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">XOF Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Abstract base class for Extendable-Output Functions (XOFs).
|
|
<a href="classXOF.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="XOF_8h_source.html">XOF.h</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for XOF:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="classXOF.png" usemap="#XOF_map" alt=""/>
|
|
<map id="XOF_map" name="XOF_map">
|
|
<area href="classSHAKE.html" title="Abstract base class for the SHAKE Extendable-Output Functions (XOFs). " alt="SHAKE" shape="rect" coords="42,56,117,80"/>
|
|
<area href="classSHAKE128.html" title="SHAKE Extendable-Output Function (XOF) with 128-bit security. " alt="SHAKE128" shape="rect" coords="0,112,75,136"/>
|
|
<area href="classSHAKE256.html" title="SHAKE Extendable-Output Function (XOF) with 256-bit security. " alt="SHAKE256" shape="rect" coords="85,112,160,136"/>
|
|
</map>
|
|
</div></div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a855d1bb01d46b329c57b59783cd1e075"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a855d1bb01d46b329c57b59783cd1e075"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a855d1bb01d46b329c57b59783cd1e075">XOF</a> ()</td></tr>
|
|
<tr class="memdesc:a855d1bb01d46b329c57b59783cd1e075"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> object. <br/></td></tr>
|
|
<tr class="separator:a855d1bb01d46b329c57b59783cd1e075"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5164ebb6aef3e5492f81ce5d685a00af"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a5164ebb6aef3e5492f81ce5d685a00af">~XOF</a> ()</td></tr>
|
|
<tr class="memdesc:a5164ebb6aef3e5492f81ce5d685a00af"><td class="mdescLeft"> </td><td class="mdescRight">Destroys this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> object. <a href="#a5164ebb6aef3e5492f81ce5d685a00af">More...</a><br/></td></tr>
|
|
<tr class="separator:a5164ebb6aef3e5492f81ce5d685a00af"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a469429647da7d43b3aa4aef44506d01c"><td class="memItemLeft" align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a469429647da7d43b3aa4aef44506d01c">blockSize</a> () const =0</td></tr>
|
|
<tr class="memdesc:a469429647da7d43b3aa4aef44506d01c"><td class="mdescLeft"> </td><td class="mdescRight">Size of the internal block used by the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> algorithm, in bytes. <a href="#a469429647da7d43b3aa4aef44506d01c">More...</a><br/></td></tr>
|
|
<tr class="separator:a469429647da7d43b3aa4aef44506d01c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a6dd11ef356335d049da6932e2490bf03"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03">reset</a> ()=0</td></tr>
|
|
<tr class="memdesc:a6dd11ef356335d049da6932e2490bf03"><td class="mdescLeft"> </td><td class="mdescRight">Resets the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> ready for a new session. <a href="#a6dd11ef356335d049da6932e2490bf03">More...</a><br/></td></tr>
|
|
<tr class="separator:a6dd11ef356335d049da6932e2490bf03"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a35fe86f903d9102e64b1c920c69c394e"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e">update</a> (const void *data, size_t len)=0</td></tr>
|
|
<tr class="memdesc:a35fe86f903d9102e64b1c920c69c394e"><td class="mdescLeft"> </td><td class="mdescRight">Updates the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> with more data. <a href="#a35fe86f903d9102e64b1c920c69c394e">More...</a><br/></td></tr>
|
|
<tr class="separator:a35fe86f903d9102e64b1c920c69c394e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a1bb311f04dae8465c1489a4f033703cd"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd">extend</a> (uint8_t *data, size_t len)=0</td></tr>
|
|
<tr class="memdesc:a1bb311f04dae8465c1489a4f033703cd"><td class="mdescLeft"> </td><td class="mdescRight">Generates extendable output from this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. <a href="#a1bb311f04dae8465c1489a4f033703cd">More...</a><br/></td></tr>
|
|
<tr class="separator:a1bb311f04dae8465c1489a4f033703cd"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa6c027228f0459b07b61fb51c7b47c94"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94">encrypt</a> (uint8_t *output, const uint8_t *input, size_t len)=0</td></tr>
|
|
<tr class="memdesc:aa6c027228f0459b07b61fb51c7b47c94"><td class="mdescLeft"> </td><td class="mdescRight">Encrypts an input buffer with extendable output from this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. <a href="#aa6c027228f0459b07b61fb51c7b47c94">More...</a><br/></td></tr>
|
|
<tr class="separator:aa6c027228f0459b07b61fb51c7b47c94"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a1c322679dfd211cd77ae05fb201a32e8"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#a1c322679dfd211cd77ae05fb201a32e8">decrypt</a> (uint8_t *output, const uint8_t *input, size_t len)</td></tr>
|
|
<tr class="memdesc:a1c322679dfd211cd77ae05fb201a32e8"><td class="mdescLeft"> </td><td class="mdescRight">Decrypts an input buffer with extendable output from this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. <a href="#a1c322679dfd211cd77ae05fb201a32e8">More...</a><br/></td></tr>
|
|
<tr class="separator:a1c322679dfd211cd77ae05fb201a32e8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac34cb22f251642b58b3dd78a6480aff3"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classXOF.html#ac34cb22f251642b58b3dd78a6480aff3">clear</a> ()=0</td></tr>
|
|
<tr class="memdesc:ac34cb22f251642b58b3dd78a6480aff3"><td class="mdescLeft"> </td><td class="mdescRight">Clears the hash state, removing all sensitive data, and then resets the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> ready for a new session. <a href="#ac34cb22f251642b58b3dd78a6480aff3">More...</a><br/></td></tr>
|
|
<tr class="separator:ac34cb22f251642b58b3dd78a6480aff3"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Abstract base class for Extendable-Output Functions (XOFs). </p>
|
|
<p>Extendable-Output Functions, or XOFs, are a new class of cryptographic primitive that was defined by NIST during the SHA-3 standardization process. Essentially an <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> is a hash algorithm that has an arbitrary-length output instead of a fixed-length digest.</p>
|
|
<p>XOFs can be used for a variety of cryptographic tasks:</p>
|
|
<ul>
|
|
<li>Mask generation functions for RSA OAEP style padding. </li>
|
|
<li>Key derivation functions for expanding key seed material into arbitrary amounts of keying material for a secure session. </li>
|
|
<li>Stream ciphers based on a key and IV.</li>
|
|
</ul>
|
|
<p>To use an <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>, it is first <a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a> and then data is added via multiple calls to <a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a>:</p>
|
|
<div class="fragment"><div class="line"><a class="code" href="classSHAKE256.html">SHAKE256</a> xof;</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#af199eea3c22bb193638827163c2b23db">reset</a>();</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(data1, <span class="keyword">sizeof</span>(data1));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(data2, <span class="keyword">sizeof</span>(data2));</div>
|
|
<div class="line">...</div>
|
|
</div><!-- fragment --><p>Once all input data has been added, the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> switches into extend mode to generate the arbitrary-length output data:</p>
|
|
<div class="fragment"><div class="line">xof.<a class="code" href="classSHAKE.html#ac3fe37617644e3498d40a86e846562fb">extend</a>(output1, <span class="keyword">sizeof</span>(output1));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#ac3fe37617644e3498d40a86e846562fb">extend</a>(output2, <span class="keyword">sizeof</span>(output2));</div>
|
|
<div class="line">...</div>
|
|
</div><!-- fragment --><p>Mask generation and key derivation is achieved as follows, where the key is unique for each invocation:</p>
|
|
<div class="fragment"><div class="line"><a class="code" href="classSHAKE256.html">SHAKE256</a> xof;</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#af199eea3c22bb193638827163c2b23db">reset</a>();</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(key, <span class="keyword">sizeof</span>(key));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#ac3fe37617644e3498d40a86e846562fb">extend</a>(output, <span class="keyword">sizeof</span>(output));</div>
|
|
</div><!-- fragment --><p>Stream ciphers can be constructed as follows, using the special <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> function that XOR's the output of <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a> with the input plaintext to generate the output ciphertext (or alternatively XOR's the output of <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a> with the ciphertext to recover the plaintext):</p>
|
|
<div class="fragment"><div class="line"><a class="code" href="classSHAKE256.html">SHAKE256</a> xof;</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#af199eea3c22bb193638827163c2b23db">reset</a>();</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(key, <span class="keyword">sizeof</span>(key));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(iv, <span class="keyword">sizeof</span>(iv));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#a6621c9d1ffbf8c34780b901275ceb81f">encrypt</a>(output1, input1, <span class="keyword">sizeof</span>(input1));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#a6621c9d1ffbf8c34780b901275ceb81f">encrypt</a>(output2, input2, <span class="keyword">sizeof</span>(input2));</div>
|
|
<div class="line">...</div>
|
|
</div><!-- fragment --><p>If the key is reused, then the IV must be different for each session or the encryption scheme can be easily broken. It is better to generate a new key and IV combination for every session.</p>
|
|
<p>It may also be a good idea to include some tag information with the input data to distinguish different uses of the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. For example:</p>
|
|
<div class="fragment"><div class="line"><a class="code" href="classSHAKE256.html">SHAKE256</a> xof;</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#af199eea3c22bb193638827163c2b23db">reset</a>();</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(key, <span class="keyword">sizeof</span>(key));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(iv, <span class="keyword">sizeof</span>(iv));</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">update</a>(<span class="stringliteral">"MyCrypt"</span>, 7);</div>
|
|
<div class="line">xof.<a class="code" href="classSHAKE.html#a6621c9d1ffbf8c34780b901275ceb81f">encrypt</a>(output, input, <span class="keyword">sizeof</span>(input));</div>
|
|
</div><!-- fragment --><p>If the same key and IV was used with a different package, then it would not generate the same output as "MyCrypt".</p>
|
|
<p>NIST warns that XOFs should not be used in place of hash functions. This is because of related outputs: if the same input is provided to an <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> with different output lengths, then the shorter output will be a prefix of the larger. This breaks the expected collision-resistance of regular hash functions. There is typically no need to use an <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> for hashing because NIST has already defined <a class="el" href="classSHA3__256.html" title="SHA3-256 hash algorithm. ">SHA3_256</a> and <a class="el" href="classSHA3__512.html" title="SHA3-512 hash algorithm. ">SHA3_512</a> for that purpose.</p>
|
|
<p>Reference: <a href="http://en.wikipedia.org/wiki/SHA-3">http://en.wikipedia.org/wiki/SHA-3</a></p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classSHAKE256.html" title="SHAKE Extendable-Output Function (XOF) with 256-bit security. ">SHAKE256</a>, <a class="el" href="classSHAKE128.html" title="SHAKE Extendable-Output Function (XOF) with 128-bit security. ">SHAKE128</a>, <a class="el" href="classSHA3__256.html" title="SHA3-256 hash algorithm. ">SHA3_256</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="XOF_8h_source.html#l00029">29</a> of file <a class="el" href="XOF_8h_source.html">XOF.h</a>.</p>
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="a5164ebb6aef3e5492f81ce5d685a00af"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">XOF::~XOF </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Destroys this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> object. </p>
|
|
<dl class="section note"><dt>Note</dt><dd>Subclasses are responsible for clearing any sensitive data that remains in the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> object when it is destroyed.</dd></dl>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#ac34cb22f251642b58b3dd78a6480aff3" title="Clears the hash state, removing all sensitive data, and then resets the XOF ready for a new session...">clear()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="XOF_8cpp_source.html#l00134">134</a> of file <a class="el" href="XOF_8cpp_source.html">XOF.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="a469429647da7d43b3aa4aef44506d01c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t XOF::blockSize </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Size of the internal block used by the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> algorithm, in bytes. </p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classSHAKE.html#a635b2475049541f73eaf577ed8e67cb7">SHAKE</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ac34cb22f251642b58b3dd78a6480aff3"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void XOF::clear </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Clears the hash state, removing all sensitive data, and then resets the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> ready for a new session. </p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classSHAKE.html#ab86f52425c1d5b0e5c924b4f96121fe0">SHAKE</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a1c322679dfd211cd77ae05fb201a32e8"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void XOF::decrypt </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>output</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>input</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </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> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Decrypts an input buffer with extendable output from this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">output</td><td>The output buffer to write to, which may be the same buffer as <em>input</em>. The <em>output</em> buffer must have at least as many bytes as the <em>input</em> buffer. </td></tr>
|
|
<tr><td class="paramname">input</td><td>The input buffer to read from. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The number of bytes to encrypt.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>This is a convenience function that merely calls <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a>.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a>, <a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a>, <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a>, <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="XOF_8h_source.html#l00043">43</a> of file <a class="el" href="XOF_8h_source.html">XOF.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aa6c027228f0459b07b61fb51c7b47c94"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void XOF::encrypt </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>output</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>input</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Encrypts an input buffer with extendable output from this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">output</td><td>The output buffer to write to, which may be the same buffer as <em>input</em>. The <em>output</em> buffer must have at least as many bytes as the <em>input</em> buffer. </td></tr>
|
|
<tr><td class="paramname">input</td><td>The input buffer to read from. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The number of bytes to encrypt.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>This function is a convenience that generates data with <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a> and then XOR's it with the contents of <em>input</em> to generate the <em>output</em>. This function can also be used to decrypt.</p>
|
|
<p>The <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> function can be called multiple times with different regions of the plaintext data.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a>, <a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a>, <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a>, <a class="el" href="classXOF.html#a1c322679dfd211cd77ae05fb201a32e8" title="Decrypts an input buffer with extendable output from this XOF. ">decrypt()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classSHAKE.html#a6621c9d1ffbf8c34780b901275ceb81f">SHAKE</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a1bb311f04dae8465c1489a4f033703cd"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void XOF::extend </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Generates extendable output from this <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">data</td><td>The data buffer to be filled. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The number of bytes to write to <em>data</em>.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a>, <a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a>, <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classSHAKE.html#ac3fe37617644e3498d40a86e846562fb">SHAKE</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a6dd11ef356335d049da6932e2490bf03"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void XOF::reset </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Resets the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> ready for a new session. </p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a>, <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a>, <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classSHAKE.html#af199eea3c22bb193638827163c2b23db">SHAKE</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a35fe86f903d9102e64b1c920c69c394e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void XOF::update </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const void * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Updates the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a> with more data. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">data</td><td>Data to be hashed. </td></tr>
|
|
<tr><td class="paramname">len</td><td>Number of bytes of data to be added to the <a class="el" href="classXOF.html" title="Abstract base class for Extendable-Output Functions (XOFs). ">XOF</a>.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>If <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a> or <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> has already been called, then the behavior of <a class="el" href="classXOF.html#a35fe86f903d9102e64b1c920c69c394e" title="Updates the XOF with more data. ">update()</a> will be undefined. Call <a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a> first to start a new session.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXOF.html#a6dd11ef356335d049da6932e2490bf03" title="Resets the XOF ready for a new session. ">reset()</a>, <a class="el" href="classXOF.html#a1bb311f04dae8465c1489a4f033703cd" title="Generates extendable output from this XOF. ">extend()</a>, <a class="el" href="classXOF.html#aa6c027228f0459b07b61fb51c7b47c94" title="Encrypts an input buffer with extendable output from this XOF. ">encrypt()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classSHAKE.html#aa6f3a32427433aabe20adccb6994a4aa">SHAKE</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="XOF_8h_source.html">XOF.h</a></li>
|
|
<li><a class="el" href="XOF_8cpp_source.html">XOF.cpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Fri Apr 27 2018 12:01:32 for Arduino Cryptography Library by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.6
|
|
</small></address>
|
|
</body>
|
|
</html>
|