<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crypto++: basecode.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.7 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div> <h1>basecode.h</h1><pre class="fragment"><div>00001 <span class="preprocessor">#ifndef CRYPTOPP_BASECODE_H</span> 00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_BASECODE_H</span> 00003 <span class="preprocessor"></span> 00004 <span class="preprocessor">#include "filters.h"</span> 00005 <span class="preprocessor">#include "algparam.h"</span> 00006 <span class="preprocessor">#include "argnames.h"</span> 00007 00008 NAMESPACE_BEGIN(CryptoPP) 00009 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">BaseN_Encoder</a> : public <a class="code" href="class_unflushable.html">Unflushable</a><<a class="code" href="class_filter.html">Filter</a>> 00012 { 00013 <span class="keyword">public</span>: 00014 <a class="code" href="class_base_n___encoder.html">BaseN_Encoder</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> *attachment=NULL) 00015 {Detach(attachment);} 00016 00017 <a class="code" href="class_base_n___encoder.html">BaseN_Encoder</a>(<span class="keyword">const</span> byte *alphabet, <span class="keywordtype">int</span> log2base, <a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> *attachment=NULL, <span class="keywordtype">int</span> padding=-1) 00018 { 00019 Detach(attachment); 00020 IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet) 00021 (Name::Log2Base(), log2base) 00022 (Name::Pad(), padding != -1) 00023 (Name::PaddingByte(), byte(padding))); 00024 } 00025 00026 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html">NameValuePairs</a> &parameters); 00027 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Put2(<span class="keyword">const</span> byte *begin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); 00028 00029 <span class="keyword">private</span>: 00030 <span class="keyword">const</span> byte *m_alphabet; 00031 <span class="keywordtype">int</span> m_padding, m_bitsPerChar, m_outputBlockSize; 00032 <span class="keywordtype">int</span> m_bytePos, m_bitPos; 00033 <a class="code" href="class_sec_block.html">SecByteBlock</a> m_outBuf; 00034 }; 00035 <span class="comment"></span> 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 BaseN_Decoder : <span class="keyword">public</span> <a class="code" href="class_unflushable.html">Unflushable</a><Filter> 00038 { 00039 <span class="keyword">public</span>: 00040 BaseN_Decoder(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> *attachment=NULL) 00041 {Detach(attachment);} 00042 00043 BaseN_Decoder(<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">BufferedTransformation</a> *attachment=NULL) 00044 { 00045 Detach(attachment); 00046 IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base)); 00047 } 00048 00049 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html">NameValuePairs</a> &parameters); 00050 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Put2(<span class="keyword">const</span> byte *begin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); 00051 00052 <span class="keyword">static</span> <span class="keywordtype">void</span> 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); 00053 00054 <span class="keyword">private</span>: 00055 <span class="keyword">const</span> <span class="keywordtype">int</span> *m_lookup; 00056 <span class="keywordtype">int</span> m_padding, m_bitsPerChar, m_outputBlockSize; 00057 <span class="keywordtype">int</span> m_bytePos, m_bitPos; 00058 <a class="code" href="class_sec_block.html">SecByteBlock</a> m_outBuf; 00059 }; 00060 <span class="comment"></span> 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 Grouper : <span class="keyword">public</span> <a class="code" href="class_bufferless.html">Bufferless</a><Filter> 00063 { 00064 <span class="keyword">public</span>: 00065 Grouper(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> *attachment=NULL) 00066 {Detach(attachment);} 00067 00068 Grouper(<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">BufferedTransformation</a> *attachment=NULL) 00069 { 00070 Detach(attachment); 00071 IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize) 00072 (Name::Separator(), <a class="code" href="class_const_byte_array_parameter.html">ConstByteArrayParameter</a>(separator)) 00073 (Name::Terminator(), <a class="code" href="class_const_byte_array_parameter.html">ConstByteArrayParameter</a>(terminator))); 00074 } 00075 00076 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html">NameValuePairs</a> &parameters); 00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Put2(<span class="keyword">const</span> byte *begin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); 00078 00079 <span class="keyword">private</span>: 00080 <a class="code" href="class_sec_block.html">SecByteBlock</a> m_separator, m_terminator; 00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_groupSize, m_counter; 00082 }; 00083 00084 NAMESPACE_END 00085 00086 <span class="preprocessor">#endif</span> </div></pre><hr size="1"><address style="align: right;"><small>Generated on Sun Nov 7 08:23:56 2004 for Crypto++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address> </body> </html>