<!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"/> <title>Crypto++: BlockTransformation Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Crypto++</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</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> </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> </div> <div class="header"> <div class="summary"> <a href="#pub-types">Public Types</a> | <a href="#pub-methods">Public Member Functions</a> | <a href="#pub-attribs">Public Attributes</a> </div> <div class="headertitle"> <div class="title">BlockTransformation Class Reference</div> </div> </div> <div class="contents"> <!-- doxytag: class="BlockTransformation" --><!-- doxytag: inherits="Algorithm" --> <p>interface for the data processing part of block ciphers <a href="class_block_transformation.html#details">More...</a></p> <p><code>#include <<a class="el" href="cryptlib_8h_source.html">cryptlib.h</a>></code></p> <div class="dynheader"> Inheritance diagram for BlockTransformation:</div> <div class="dyncontent"> <div class="center"> <img src="class_block_transformation.png" usemap="#BlockTransformation_map" alt=""/> <map id="BlockTransformation_map" name="BlockTransformation_map"> <area href="class_algorithm.html" title="interface for all crypto algorithms" alt="Algorithm" shape="rect" coords="0,56,322,80"/> <area href="class_clonable.html" title="interface for cloning objects, this is not implemented by most classes yet" alt="Clonable" shape="rect" coords="0,0,322,24"/> <area href="class_block_cipher.html" title="interface for one direction (encryption or decryption) of a block cipher" alt="BlockCipher" shape="rect" coords="0,168,322,192"/> <area href="class_s_a_f_e_r_1_1_base.html" alt="SAFER::Base" shape="rect" coords="332,224,654,248"/> <area href="class_simple_keying_interface_impl.html" alt="SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >" shape="rect" coords="332,280,654,304"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, Blowfish_Info >" shape="rect" coords="332,336,654,360"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, Camellia_Info >" shape="rect" coords="332,392,654,416"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, CAST128_Info >" shape="rect" coords="332,448,654,472"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, CAST256_Info >" shape="rect" coords="332,504,654,528"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, DES_EDE2_Info >" shape="rect" coords="332,560,654,584"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, DES_EDE3_Info >" shape="rect" coords="332,616,654,640"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, DES_Info >" shape="rect" coords="332,672,654,696"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, DES_XEX3_Info >" shape="rect" coords="332,728,654,752"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, GOST_Info >" shape="rect" coords="332,784,654,808"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, IDEA_Info >" shape="rect" coords="332,840,654,864"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, LR_Info< T > >" shape="rect" coords="332,896,654,920"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, MARS_Info >" shape="rect" coords="332,952,654,976"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, MDC_Info< T > >" shape="rect" coords="332,1008,654,1032"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, RC2_Info >" shape="rect" coords="332,1064,654,1088"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, RC5_Info >" shape="rect" coords="332,1120,654,1144"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, RC6_Info >" shape="rect" coords="332,1176,654,1200"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, Rijndael_Info >" shape="rect" coords="332,1232,654,1256"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, SEED_Info >" shape="rect" coords="332,1288,654,1312"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, Serpent_Info >" shape="rect" coords="332,1344,654,1368"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, SHACAL2_Info >" shape="rect" coords="332,1400,654,1424"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, SHARK_Info >" shape="rect" coords="332,1456,654,1480"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, SKIPJACK_Info >" shape="rect" coords="332,1512,654,1536"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, Square_Info >" shape="rect" coords="332,1568,654,1592"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, TEA_Info >" shape="rect" coords="332,1624,654,1648"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, ThreeWay_Info >" shape="rect" coords="332,1680,654,1704"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, Twofish_Info >" shape="rect" coords="332,1736,654,1760"/> <area href="class_two_bases.html" alt="TwoBases< BlockCipher, XTEA_Info >" shape="rect" coords="332,1792,654,1816"/> </map> </div></div> <p><a href="class_block_transformation-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-types"></a> Public Types</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom">{ <br/>   <b>BT_InBlockIsCounter</b> = 1, <b>BT_DontIncrementInOutPointers</b> = 2, <b>BT_XorInput</b> = 4, <b>BT_ReverseDirection</b> = 8, <br/>   <b>BT_AllowParallel</b> = 16 <br/> }</td></tr> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1904cf145e4c5c650dd7aff32f54e153"></a><!-- doxytag: member="BlockTransformation::ProcessAndXorBlock" ref="a1904cf145e4c5c650dd7aff32f54e153" args="(const byte *inBlock, const byte *xorBlock, byte *outBlock) const =0" --> virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a1904cf145e4c5c650dd7aff32f54e153">ProcessAndXorBlock</a> (const byte *inBlock, const byte *xorBlock, byte *outBlock) const =0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">encrypt or decrypt inBlock, xor with xorBlock, and write to outBlock <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a2fefb3f4c6c6297c0c91fcbba9e4f4f3">ProcessBlock</a> (const byte *inBlock, byte *outBlock) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">encrypt or decrypt one block <a href="#a2fefb3f4c6c6297c0c91fcbba9e4f4f3"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a12cc1846de571557be0f82471e8904bf"></a><!-- doxytag: member="BlockTransformation::ProcessBlock" ref="a12cc1846de571557be0f82471e8904bf" args="(byte *inoutBlock) const " --> void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a12cc1846de571557be0f82471e8904bf">ProcessBlock</a> (byte *inoutBlock) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">encrypt or decrypt one block in place <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adfdb78b033996020435c3dcffdca76ce"></a><!-- doxytag: member="BlockTransformation::BlockSize" ref="adfdb78b033996020435c3dcffdca76ce" args="() const =0" --> virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#adfdb78b033996020435c3dcffdca76ce">BlockSize</a> () const =0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">block size of the cipher in bytes <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0f53d1bce5bc7d7de661b84a4c954244"></a><!-- doxytag: member="BlockTransformation::OptimalDataAlignment" ref="a0f53d1bce5bc7d7de661b84a4c954244" args="() const " --> virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a0f53d1bce5bc7d7de661b84a4c954244">OptimalDataAlignment</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns how inputs and outputs should be aligned for optimal performance <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8d154fdac89307d9edbd2a5ab97fa080"></a><!-- doxytag: member="BlockTransformation::IsPermutation" ref="a8d154fdac89307d9edbd2a5ab97fa080" args="() const " --> virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a8d154fdac89307d9edbd2a5ab97fa080">IsPermutation</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns true if this is a permutation (i.e. there is an inverse transformation) <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a50f2565057bc9ba7bb70a98d9c9b39cd"></a><!-- doxytag: member="BlockTransformation::IsForwardTransformation" ref="a50f2565057bc9ba7bb70a98d9c9b39cd" args="() const =0" --> virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a50f2565057bc9ba7bb70a98d9c9b39cd">IsForwardTransformation</a> () const =0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns true if this is an encryption object <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7aceb4c214d901e9cc416b05d40eb282"></a><!-- doxytag: member="BlockTransformation::OptimalNumberOfParallelBlocks" ref="a7aceb4c214d901e9cc416b05d40eb282" args="() const " --> virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#a7aceb4c214d901e9cc416b05d40eb282">OptimalNumberOfParallelBlocks</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">return number of blocks that can be processed in parallel, for bit-slicing implementations <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="class_block_transformation.html#adcff119bb709c84bfaaab8d1871b018c">AdvancedProcessBlocks</a> (const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">encrypt and xor blocks according to flags (see FlagsForAdvancedProcessBlocks) <a href="#adcff119bb709c84bfaaab8d1871b018c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abf4c2e7cf9a5c3bb1729e9d1126f0d7c"></a><!-- doxytag: member="BlockTransformation::GetCipherDirection" ref="abf4c2e7cf9a5c3bb1729e9d1126f0d7c" args="() const " --> <a class="el" href="cryptlib_8h.html#a353ccabf5ddc119a6a33e92f7b9961c7">CipherDir</a> </td><td class="memItemRight" valign="bottom"><b>GetCipherDirection</b> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acd21c6715add4884fa043eaf51655039"></a><!-- doxytag: member="BlockTransformation::AlgorithmName" ref="acd21c6715add4884fa043eaf51655039" args="() const " --> virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_algorithm.html#acd21c6715add4884fa043eaf51655039">AlgorithmName</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns name of this algorithm, not universally implemented yet <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a24b43349a71e1f98508eeb10b31a0a62"></a><!-- doxytag: member="BlockTransformation::Clone" ref="a24b43349a71e1f98508eeb10b31a0a62" args="() const " --> virtual <a class="el" href="class_clonable.html">Clonable</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_clonable.html#a24b43349a71e1f98508eeb10b31a0a62">Clone</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">this is not implemented by most classes yet <br/></td></tr> <tr><td colspan="2"><h2><a name="pub-attribs"></a> Public Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adbdffb84a7518cb2b44378111a6ee69b"></a><!-- doxytag: member="BlockTransformation::FlagsForAdvancedProcessBlocks" ref="adbdffb84a7518cb2b44378111a6ee69b" args="" --> enum BlockTransformation:: { ... }  </td><td class="memItemRight" valign="bottom"><b>FlagsForAdvancedProcessBlocks</b></td></tr> </table> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>interface for the data processing part of block ciphers </p> <p>Classes derived from <a class="el" href="class_block_transformation.html" title="interface for the data processing part of block ciphers">BlockTransformation</a> are block ciphers in ECB mode (for example the <a class="el" href="class_d_e_s.html#acf2cdef8c9a64ca67a44117658890aa5" title="implements the BlockCipher interface">DES::Encryption</a> class), which are stateless. These classes should not be used directly, but only in combination with a mode class (see <a class="el" href="struct_cipher_mode_documentation.html" title="Cipher modes documentation. See NIST SP 800-38A for definitions of these modes. See AuthenticatedSymm...">CipherModeDocumentation</a> in <a class="el" href="modes_8h.html">modes.h</a>). </p> <p>Definition at line <a class="el" href="cryptlib_8h_source.html#l00429">429</a> of file <a class="el" href="cryptlib_8h_source.html">cryptlib.h</a>.</p> </div><hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a2fefb3f4c6c6297c0c91fcbba9e4f4f3"></a><!-- doxytag: member="BlockTransformation::ProcessBlock" ref="a2fefb3f4c6c6297c0c91fcbba9e4f4f3" args="(const byte *inBlock, byte *outBlock) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void BlockTransformation::ProcessBlock </td> <td>(</td> <td class="paramtype">const byte * </td> <td class="paramname"><em>inBlock</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">byte * </td> <td class="paramname"><em>outBlock</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>encrypt or decrypt one block </p> <dl class="pre"><dt><b>Precondition:</b></dt><dd>size of inBlock and outBlock == <a class="el" href="class_block_transformation.html#adfdb78b033996020435c3dcffdca76ce" title="block size of the cipher in bytes">BlockSize()</a> </dd></dl> <p>Definition at line <a class="el" href="cryptlib_8h_source.html#l00437">437</a> of file <a class="el" href="cryptlib_8h_source.html">cryptlib.h</a>.</p> <p>Referenced by <a class="el" href="cryptlib_8cpp_source.html#l00141">AdvancedProcessBlocks()</a>, <a class="el" href="modes_8cpp_source.html#l00209">CBC_CTS_Decryption::ProcessLastBlock()</a>, <a class="el" href="modes_8cpp_source.html#l00168">CBC_CTS_Encryption::ProcessLastBlock()</a>, <a class="el" href="vmac_8cpp_source.html#l00099">VMAC_Base::Resynchronize()</a>, and <a class="el" href="cmac_8cpp_source.html#l00058">CMAC_Base::Update()</a>.</p> </div> </div> <a class="anchor" id="adcff119bb709c84bfaaab8d1871b018c"></a><!-- doxytag: member="BlockTransformation::AdvancedProcessBlocks" ref="adcff119bb709c84bfaaab8d1871b018c" args="(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">size_t BlockTransformation::AdvancedProcessBlocks </td> <td>(</td> <td class="paramtype">const byte * </td> <td class="paramname"><em>inBlocks</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const byte * </td> <td class="paramname"><em>xorBlocks</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">byte * </td> <td class="paramname"><em>outBlocks</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">word32 </td> <td class="paramname"><em>flags</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>encrypt and xor blocks according to flags (see FlagsForAdvancedProcessBlocks) </p> <p>/note If BT_InBlockIsCounter is set, last byte of inBlocks may be modified. </p> <p>Definition at line <a class="el" href="cryptlib_8cpp_source.html#l00141">141</a> of file <a class="el" href="cryptlib_8cpp_source.html">cryptlib.cpp</a>.</p> <p>References <a class="el" href="class_block_transformation.html#adfdb78b033996020435c3dcffdca76ce">BlockSize()</a>, <a class="el" href="class_block_transformation.html#a1904cf145e4c5c650dd7aff32f54e153">ProcessAndXorBlock()</a>, and <a class="el" href="cryptlib_8h_source.html#l00437">ProcessBlock()</a>.</p> <p>Referenced by <a class="el" href="modes_8cpp_source.html#l00195">CBC_Decryption::ProcessData()</a>, <a class="el" href="modes_8cpp_source.html#l00155">CBC_Encryption::ProcessData()</a>, <a class="el" href="modes_8cpp_source.html#l00149">ECB_OneWay::ProcessData()</a>, <a class="el" href="cmac_8cpp_source.html#l00099">CMAC_Base::TruncatedFinal()</a>, <a class="el" href="cmac_8cpp_source.html#l00058">CMAC_Base::Update()</a>, and <a class="el" href="cbcmac_8cpp_source.html#l00016">CBC_MAC_Base::Update()</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="cryptlib_8h_source.html">cryptlib.h</a></li> <li><a class="el" href="cryptlib_8cpp_source.html">cryptlib.cpp</a></li> </ul> </div> <hr class="footer"/><address class="footer"><small>Generated on Sun Oct 16 2011 for Crypto++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>