1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00
arduinolibs/classXTS.html
Rhys Weatherley e923155962 Update docs
2017-11-03 10:49:30 +10:00

229 lines
25 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>ArduinoLibs: XTS&lt; T1, T2 &gt; Class Template 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">ArduinoLibs
</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&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</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&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;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">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</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> &#124;
<a href="classXTS-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">XTS&lt; T1, T2 &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Implementation of the <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode for 128-bit block ciphers.
<a href="classXTS.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="XTS_8h_source.html">XTS.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for XTS&lt; T1, T2 &gt;:</div>
<div class="dyncontent">
<div class="center">
<img src="classXTS.png" usemap="#XTS&lt; T1, T2 &gt;_map" alt=""/>
<map id="XTS&lt; T1, T2 &gt;_map" name="XTS&lt; T1, T2 &gt;_map">
<area href="classXTSCommon.html" title="Concrete base class to assist with implementing XTS mode for 128-bit block ciphers. " alt="XTSCommon" shape="rect" coords="0,0,97,24"/>
</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:ae37ec61a7d4275071d52dfc61e467736"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTS.html#ae37ec61a7d4275071d52dfc61e467736">XTS</a> ()</td></tr>
<tr class="memdesc:ae37ec61a7d4275071d52dfc61e467736"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs an object for encrypting sectors in <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode. <a href="#ae37ec61a7d4275071d52dfc61e467736">More...</a><br/></td></tr>
<tr class="separator:ae37ec61a7d4275071d52dfc61e467736"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97410cd5abc63921870c9610b03421b8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a97410cd5abc63921870c9610b03421b8"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTS.html#a97410cd5abc63921870c9610b03421b8">~XTS</a> ()</td></tr>
<tr class="memdesc:a97410cd5abc63921870c9610b03421b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears all sensitive information and destroys this object. <br/></td></tr>
<tr class="separator:a97410cd5abc63921870c9610b03421b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classXTSCommon"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classXTSCommon')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classXTSCommon.html">XTSCommon</a></td></tr>
<tr class="memitem:ac5398f0bd2201e7d3fa335899fb3c6f3 inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac5398f0bd2201e7d3fa335899fb3c6f3"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#ac5398f0bd2201e7d3fa335899fb3c6f3">~XTSCommon</a> ()</td></tr>
<tr class="memdesc:ac5398f0bd2201e7d3fa335899fb3c6f3 inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears all sensitive information and destroys this object. <br/></td></tr>
<tr class="separator:ac5398f0bd2201e7d3fa335899fb3c6f3 inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2da350825a438355665683ab9eb57aa7 inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">virtual size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a2da350825a438355665683ab9eb57aa7">keySize</a> () const </td></tr>
<tr class="memdesc:a2da350825a438355665683ab9eb57aa7 inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the size of the key for <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode. <a href="#a2da350825a438355665683ab9eb57aa7">More...</a><br/></td></tr>
<tr class="separator:a2da350825a438355665683ab9eb57aa7 inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb3ebf14c7879bcbc92e3d6cc70b19a9 inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#afb3ebf14c7879bcbc92e3d6cc70b19a9">tweakSize</a> () const </td></tr>
<tr class="memdesc:afb3ebf14c7879bcbc92e3d6cc70b19a9 inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the maximum supported size for the tweak. <a href="#afb3ebf14c7879bcbc92e3d6cc70b19a9">More...</a><br/></td></tr>
<tr class="separator:afb3ebf14c7879bcbc92e3d6cc70b19a9 inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b96255bdf33eccca8f64eb1572cf8eb inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a7b96255bdf33eccca8f64eb1572cf8eb">sectorSize</a> () const </td></tr>
<tr class="memdesc:a7b96255bdf33eccca8f64eb1572cf8eb inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the size of sectors encrypted or decrypted by this class. <a href="#a7b96255bdf33eccca8f64eb1572cf8eb">More...</a><br/></td></tr>
<tr class="separator:a7b96255bdf33eccca8f64eb1572cf8eb inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7e0aa61628285073545a8f8e0b0d981d inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a7e0aa61628285073545a8f8e0b0d981d">setSectorSize</a> (size_t size)</td></tr>
<tr class="memdesc:a7e0aa61628285073545a8f8e0b0d981d inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the size of sectors encrypted or decrypted by this class. <a href="#a7e0aa61628285073545a8f8e0b0d981d">More...</a><br/></td></tr>
<tr class="separator:a7e0aa61628285073545a8f8e0b0d981d inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a68b1ad6bad0b29aeb97dea80e4e03170 inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a68b1ad6bad0b29aeb97dea80e4e03170">setKey</a> (const uint8_t *key, size_t len)</td></tr>
<tr class="memdesc:a68b1ad6bad0b29aeb97dea80e4e03170 inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the key to use for <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode. <a href="#a68b1ad6bad0b29aeb97dea80e4e03170">More...</a><br/></td></tr>
<tr class="separator:a68b1ad6bad0b29aeb97dea80e4e03170 inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a744a533d46078de5ea9723139f74bcdb inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a744a533d46078de5ea9723139f74bcdb">setTweak</a> (const uint8_t *tweak, size_t len)</td></tr>
<tr class="memdesc:a744a533d46078de5ea9723139f74bcdb inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the tweak value for the current sector to encrypt or decrypt. <a href="#a744a533d46078de5ea9723139f74bcdb">More...</a><br/></td></tr>
<tr class="separator:a744a533d46078de5ea9723139f74bcdb inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bf1cbd4c1a5422a3cf285fe995fe0e7 inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a8bf1cbd4c1a5422a3cf285fe995fe0e7">encryptSector</a> (uint8_t *output, const uint8_t *input)</td></tr>
<tr class="memdesc:a8bf1cbd4c1a5422a3cf285fe995fe0e7 inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encrypts an entire sector of data. <a href="#a8bf1cbd4c1a5422a3cf285fe995fe0e7">More...</a><br/></td></tr>
<tr class="separator:a8bf1cbd4c1a5422a3cf285fe995fe0e7 inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7dd21d5a994724e2af433872ecc3a90b inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a7dd21d5a994724e2af433872ecc3a90b">decryptSector</a> (uint8_t *output, const uint8_t *input)</td></tr>
<tr class="memdesc:a7dd21d5a994724e2af433872ecc3a90b inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decrypts an entire sector of data. <a href="#a7dd21d5a994724e2af433872ecc3a90b">More...</a><br/></td></tr>
<tr class="separator:a7dd21d5a994724e2af433872ecc3a90b inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96e3cb4a3d35dc4e3a5acbae19b4465b inherit pub_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a96e3cb4a3d35dc4e3a5acbae19b4465b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#a96e3cb4a3d35dc4e3a5acbae19b4465b">clear</a> ()</td></tr>
<tr class="memdesc:a96e3cb4a3d35dc4e3a5acbae19b4465b inherit pub_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears all security-sensitive state from this <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> object. <br/></td></tr>
<tr class="separator:a96e3cb4a3d35dc4e3a5acbae19b4465b inherit pub_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_methods_classXTSCommon"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classXTSCommon')"><img src="closed.png" alt="-"/>&#160;Protected Member Functions inherited from <a class="el" href="classXTSCommon.html">XTSCommon</a></td></tr>
<tr class="memitem:ae3ce2a2a72eb839f8ccde4a166ad40e6 inherit pro_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae3ce2a2a72eb839f8ccde4a166ad40e6"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#ae3ce2a2a72eb839f8ccde4a166ad40e6">XTSCommon</a> ()</td></tr>
<tr class="memdesc:ae3ce2a2a72eb839f8ccde4a166ad40e6 inherit pro_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs an <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> object with a default sector size of 512 bytes. <br/></td></tr>
<tr class="separator:ae3ce2a2a72eb839f8ccde4a166ad40e6 inherit pro_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aade8a16b70a49e8b04cb776522b29b7e inherit pro_methods_classXTSCommon"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXTSCommon.html#aade8a16b70a49e8b04cb776522b29b7e">setBlockCiphers</a> (<a class="el" href="classBlockCipher.html">BlockCipher</a> *cipher1, <a class="el" href="classBlockCipher.html">BlockCipher</a> *cipher2)</td></tr>
<tr class="memdesc:aade8a16b70a49e8b04cb776522b29b7e inherit pro_methods_classXTSCommon"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the two block ciphers to use for <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode. <a href="#aade8a16b70a49e8b04cb776522b29b7e">More...</a><br/></td></tr>
<tr class="separator:aade8a16b70a49e8b04cb776522b29b7e inherit pro_methods_classXTSCommon"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename T1, typename T2 = T1&gt;<br/>
class XTS&lt; T1, T2 &gt;</h3>
<p>Implementation of the <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode for 128-bit block ciphers. </p>
<p><a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode implements the XEX tweakable block cipher mode with ciphertext stealing for data that isn't a multiple of the 128-bit block size.</p>
<p><a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> was designed for use in disk encryption where a large number of equal-sized "sectors" need to be encrypted in a way that information from one sector cannot be used to decrypt the other sectors. The mode combines the key with a sector-specific "tweak" which is usually based on the sector number.</p>
<p>Some Arduino systems have SD cards, but typically embedded systems do not have disk drives. However, <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> can still be useful on Arduino systems with lots of EEPROM or flash memory. If the application needs to store critical security parameters like private keys then <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> can be used to encrypt non-volatile memory to protect the parameters.</p>
<p>The following example encrypts a sector using <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode:</p>
<div class="fragment"><div class="line"><a class="code" href="classXTS.html">XTS&lt;AES256&gt;</a> xts;</div>
<div class="line">xts.<a class="code" href="classXTSCommon.html#a7e0aa61628285073545a8f8e0b0d981d">setSectorSize</a>(520);</div>
<div class="line">xts.<a class="code" href="classXTSCommon.html#a68b1ad6bad0b29aeb97dea80e4e03170">setKey</a>(key, 64); <span class="comment">// Twice the AES256 key size.</span></div>
<div class="line">xts.<a class="code" href="classXTSCommon.html#a744a533d46078de5ea9723139f74bcdb">setTweak</a>(sectorNumber, <span class="keyword">sizeof</span>(sectorNumber));</div>
<div class="line">xts.<a class="code" href="classXTSCommon.html#a8bf1cbd4c1a5422a3cf285fe995fe0e7">encryptSector</a>(output, input);</div>
</div><!-- fragment --><p><a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> keys are twice the size of the underlying block cipher (<a class="el" href="classAES256.html" title="AES block cipher with 256-bit keys. ">AES256</a> in the above example). The <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> key is divided into two halves. The first half is used to encrypt the plaintext and the second half is used to encrypt the sector-specific tweak. The same key can be used for both, in which case <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> is equivalent to the original XEX design upon which <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> was based. The companion <a class="el" href="classXTSSingleKey.html" title="Implementation of the single-key XTS mode for 128-bit block ciphers. ">XTSSingleKey</a> class can be used for single-key scenarios.</p>
<p>The template parameter must be a concrete subclass of <a class="el" href="classBlockCipher.html" title="Abstract base class for block ciphers. ">BlockCipher</a> indicating the specific block cipher to use. The example above uses <a class="el" href="classAES256.html" title="AES block cipher with 256-bit keys. ">AES256</a> as the underlying cipher.</p>
<p>It is also possible to specify two different block ciphers, as long as they have the same key size. Because the second half of the key is only used to encrypt tweaks and never decrypt, a reduced block cipher implementation like <a class="el" href="classSpeckTiny.html" title="Speck block cipher with a 128-bit block size (tiny-memory version). ">SpeckTiny</a> that only supports encryption can be used for the second block cipher:</p>
<div class="fragment"><div class="line"><a class="code" href="classXTS.html">XTS&lt;SpeckSmall, SpeckTiny&gt;</a> xts;</div>
</div><!-- fragment --><p>This might save some memory that would otherwise be needed for the decryption key schedule of the second block cipher. <a class="el" href="classXTSSingleKey.html" title="Implementation of the single-key XTS mode for 128-bit block ciphers. ">XTSSingleKey</a> provides another method to save memory.</p>
<p>References: <a href="http://libeccio.di.unisa.it/Crypto14/Lab/p1619.pdf">IEEE Std. 1619-2007</a>, <a href="http://csrc.nist.gov/publications/nistpubs/800-38E/nist-sp-800-38E.pdf">NIST SP 800-38E</a>, a href="http://web.cs.ucdavis.edu/~rogaway/papers/offsets.pdf"&gt;XEX.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classXTSSingleKey.html" title="Implementation of the single-key XTS mode for 128-bit block ciphers. ">XTSSingleKey</a>, <a class="el" href="classXTSCommon.html" title="Concrete base class to assist with implementing XTS mode for 128-bit block ciphers. ">XTSCommon</a> </dd></dl>
<p>Definition at line <a class="el" href="XTS_8h_source.html#l00079">79</a> of file <a class="el" href="XTS_8h_source.html">XTS.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ae37ec61a7d4275071d52dfc61e467736"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T1, typename T2 = T1&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classXTS.html">XTS</a>&lt; T1, T2 &gt;::<a class="el" href="classXTS.html">XTS</a> </td>
<td>(</td>
<td class="paramname"></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>Constructs an object for encrypting sectors in <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode. </p>
<p>This constructor should be followed by a call to <a class="el" href="classXTSCommon.html#a7e0aa61628285073545a8f8e0b0d981d" title="Sets the size of sectors encrypted or decrypted by this class. ">setSectorSize()</a>. The default sector size is 512 bytes. </p>
<p>Definition at line <a class="el" href="XTS_8h_source.html#l00082">82</a> of file <a class="el" href="XTS_8h_source.html">XTS.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="XTS_8h_source.html">XTS.h</a></li>
<li><a class="el" href="XTS_8cpp_source.html">XTS.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Nov 3 2017 10:48:53 for ArduinoLibs by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>