<!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++: basecode.h Source File</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.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>basecode.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_BASECODE_H</span> <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_BASECODE_H</span> <a name="l00003"></a>00003 <span class="preprocessor"></span> <a name="l00004"></a>00004 <span class="preprocessor">#include "filters.h"</span> <a name="l00005"></a>00005 <span class="preprocessor">#include "algparam.h"</span> <a name="l00006"></a>00006 <span class="preprocessor">#include "argnames.h"</span> <a name="l00007"></a>00007 <a name="l00008"></a>00008 NAMESPACE_BEGIN(CryptoPP) <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="comment">//! base n encoder, where n is a power of 2</span> <a name="l00011"></a><a class="code" href="class_base_n___encoder.html">00011</a> <span class="comment"></span>class CRYPTOPP_DLL <a class="code" href="class_base_n___encoder.html" title="base n encoder, where n is a power of 2">BaseN_Encoder</a> : public <a class="code" href="class_unflushable.html" title="_">Unflushable</a><<a class="code" href="class_filter.html" title="provides an implementation of BufferedTransformation&#39;s attachment interface">Filter</a>> <a name="l00012"></a>00012 { <a name="l00013"></a>00013 <span class="keyword">public</span>: <a name="l00014"></a>00014 <a class="code" href="class_base_n___encoder.html" title="base n encoder, where n is a power of 2">BaseN_Encoder</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL) <a name="l00015"></a>00015 {Detach(attachment);} <a name="l00016"></a>00016 <a name="l00017"></a>00017 <a class="code" href="class_base_n___encoder.html" title="base n encoder, where n is a power of 2">BaseN_Encoder</a>(<span class="keyword">const</span> byte *alphabet, <span class="keywordtype">int</span> log2base, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL, <span class="keywordtype">int</span> padding=-1) <a name="l00018"></a>00018 { <a name="l00019"></a>00019 Detach(attachment); <a name="l00020"></a>00020 IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet) <a name="l00021"></a>00021 (Name::Log2Base(), log2base) <a name="l00022"></a>00022 (Name::Pad(), padding != -1) <a name="l00023"></a>00023 (Name::PaddingByte(), byte(padding))); <a name="l00024"></a>00024 } <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters); <a name="l00027"></a>00027 <span class="keywordtype">size_t</span> Put2(<span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keyword">private</span>: <a name="l00030"></a>00030 <span class="keyword">const</span> byte *m_alphabet; <a name="l00031"></a>00031 <span class="keywordtype">int</span> m_padding, m_bitsPerChar, m_outputBlockSize; <a name="l00032"></a>00032 <span class="keywordtype">int</span> m_bytePos, m_bitPos; <a name="l00033"></a>00033 <a class="code" href="class_sec_block.html">SecByteBlock</a> m_outBuf; <a name="l00034"></a>00034 }; <a name="l00035"></a>00035 <span class="comment"></span> <a name="l00036"></a>00036 <span class="comment">//! base n decoder, where n is a power of 2</span> <a name="l00037"></a><a class="code" href="class_base_n___decoder.html">00037</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_base_n___decoder.html" title="base n decoder, where n is a power of 2">BaseN_Decoder</a> : <span class="keyword">public</span> <a class="code" href="class_unflushable.html" title="_">Unflushable</a><Filter> <a name="l00038"></a>00038 { <a name="l00039"></a>00039 <span class="keyword">public</span>: <a name="l00040"></a>00040 <a class="code" href="class_base_n___decoder.html" title="base n decoder, where n is a power of 2">BaseN_Decoder</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL) <a name="l00041"></a>00041 {Detach(attachment);} <a name="l00042"></a>00042 <a name="l00043"></a>00043 <a class="code" href="class_base_n___decoder.html" title="base n decoder, where n is a power of 2">BaseN_Decoder</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> *lookup, <span class="keywordtype">int</span> log2base, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL) <a name="l00044"></a>00044 { <a name="l00045"></a>00045 Detach(attachment); <a name="l00046"></a>00046 IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base)); <a name="l00047"></a>00047 } <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters); <a name="l00050"></a>00050 <span class="keywordtype">size_t</span> Put2(<span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">void</span> CRYPTOPP_API InitializeDecodingLookupArray(<span class="keywordtype">int</span> *lookup, <span class="keyword">const</span> byte *alphabet, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> base, <span class="keywordtype">bool</span> caseInsensitive); <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">private</span>: <a name="l00055"></a>00055 <span class="keyword">const</span> <span class="keywordtype">int</span> *m_lookup; <a name="l00056"></a>00056 <span class="keywordtype">int</span> m_padding, m_bitsPerChar, m_outputBlockSize; <a name="l00057"></a>00057 <span class="keywordtype">int</span> m_bytePos, m_bitPos; <a name="l00058"></a>00058 <a class="code" href="class_sec_block.html">SecByteBlock</a> m_outBuf; <a name="l00059"></a>00059 }; <a name="l00060"></a>00060 <span class="comment"></span> <a name="l00061"></a>00061 <span class="comment">//! filter that breaks input stream into groups of fixed size</span> <a name="l00062"></a><a class="code" href="class_grouper.html">00062</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_grouper.html" title="filter that breaks input stream into groups of fixed size">Grouper</a> : <span class="keyword">public</span> <a class="code" href="class_bufferless.html" title="_">Bufferless</a><Filter> <a name="l00063"></a>00063 { <a name="l00064"></a>00064 <span class="keyword">public</span>: <a name="l00065"></a>00065 <a class="code" href="class_grouper.html" title="filter that breaks input stream into groups of fixed size">Grouper</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL) <a name="l00066"></a>00066 {Detach(attachment);} <a name="l00067"></a>00067 <a name="l00068"></a>00068 <a class="code" href="class_grouper.html" title="filter that breaks input stream into groups of fixed size">Grouper</a>(<span class="keywordtype">int</span> groupSize, <span class="keyword">const</span> std::string &separator, <span class="keyword">const</span> std::string &terminator, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL) <a name="l00069"></a>00069 { <a name="l00070"></a>00070 Detach(attachment); <a name="l00071"></a>00071 IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize) <a name="l00072"></a>00072 (Name::Separator(), <a class="code" href="class_const_byte_array_parameter.html" title="used to pass byte array input as part of a NameValuePairs object">ConstByteArrayParameter</a>(separator)) <a name="l00073"></a>00073 (Name::Terminator(), <a class="code" href="class_const_byte_array_parameter.html" title="used to pass byte array input as part of a NameValuePairs object">ConstByteArrayParameter</a>(terminator))); <a name="l00074"></a>00074 } <a name="l00075"></a>00075 <a name="l00076"></a>00076 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters); <a name="l00077"></a>00077 <span class="keywordtype">size_t</span> Put2(<span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="keyword">private</span>: <a name="l00080"></a>00080 <a class="code" href="class_sec_block.html">SecByteBlock</a> m_separator, m_terminator; <a name="l00081"></a>00081 <span class="keywordtype">size_t</span> m_groupSize, m_counter; <a name="l00082"></a>00082 }; <a name="l00083"></a>00083 <a name="l00084"></a>00084 NAMESPACE_END <a name="l00085"></a>00085 <a name="l00086"></a>00086 <span class="preprocessor">#endif</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated on 9 Dec 2009 for Crypto++ by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>