Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 68d373e54fb21da3730c08bede406633 > files > 753

libCommonC++1.9_3-devel-1.9.4-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>digest.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.10 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>digest.h</h1><a href="digest_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 1999-2001 Open Source Telecom Corporation.</font>
00002 <font class="comment">//  </font>
00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font>
00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font>
00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font>
00006 <font class="comment">// (at your option) any later version.</font>
00007 <font class="comment">// </font>
00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font>
00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</font>
00011 <font class="comment">// GNU General Public License for more details.</font>
00012 <font class="comment">// </font>
00013 <font class="comment">// You should have received a copy of the GNU General Public License</font>
00014 <font class="comment">// along with this program; if not, write to the Free Software </font>
00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font>
00016 <font class="comment">// </font>
00017 <font class="comment">// As a special exception to the GNU General Public License, permission is </font>
00018 <font class="comment">// granted for additional uses of the text contained in its release </font>
00019 <font class="comment">// of Common C++.</font>
00020 <font class="comment">// </font>
00021 <font class="comment">// The exception is that, if you link the Common C++ library with other</font>
00022 <font class="comment">// files to produce an executable, this does not by itself cause the</font>
00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font>
00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font>
00025 <font class="comment">// linking the Common C++ library code into it.</font>
00026 <font class="comment">// </font>
00027 <font class="comment">// This exception does not however invalidate any other reasons why</font>
00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font>
00029 <font class="comment">// </font>
00030 <font class="comment">// This exception applies only to the code released under the </font>
00031 <font class="comment">// name Common C++.  If you copy code from other releases into a copy of</font>
00032 <font class="comment">// Common C++, as the General Public License permits, the exception does</font>
00033 <font class="comment">// not apply to the code that you add in this way.  To avoid misleading</font>
00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font>
00035 <font class="comment">// this exception notice from them.</font>
00036 <font class="comment">// </font>
00037 <font class="comment">// If you write modifications of your own for Common C++, it is your choice</font>
00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font>
00039 <font class="comment">// If you do not wish that, delete this exception notice.  </font>
00040 
00041 <font class="preprocessor">#ifndef CCXX_DIGEST_H_</font>
00042 <font class="preprocessor"></font><font class="preprocessor">#define CCXX_DIGEST_H_</font>
00043 <font class="preprocessor"></font>
00044 <font class="preprocessor">#ifndef CCXX_CONFIG_H_</font>
00045 <font class="preprocessor"></font><font class="preprocessor">#include &lt;cc++/config.h&gt;</font>
00046 <font class="preprocessor">#endif</font>
00047 <font class="preprocessor"></font>
00048 <font class="preprocessor">#ifndef CCXX_THREAD_H_</font>
00049 <font class="preprocessor"></font><font class="preprocessor">#include &lt;<a class="code" href="thread_8h.html">cc++/thread.h</a>&gt;</font>
00050 <font class="preprocessor">#endif</font>
00051 <font class="preprocessor"></font>
00052 <font class="preprocessor">#include &lt;iostream&gt;</font>
00053 <font class="preprocessor">#include &lt;fstream&gt;</font>
00054 <font class="preprocessor">#include &lt;strstream&gt;</font>
00055 
00056 <font class="preprocessor">#ifdef  CCXX_NAMESPACES</font>
00057 <font class="preprocessor"></font><font class="keyword">namespace </font>ost {
00058 <font class="preprocessor">#endif</font>
00059 <font class="preprocessor"></font>
00060 <font class="preprocessor">#ifdef WIN32</font>
00061 <font class="preprocessor"></font><font class="keyword">class </font>CCXX_CLASS_EXPORT Digest;
00062 <font class="keyword">class </font>CCXX_CLASS_EXPORT ChecksumDigest;
00063 <font class="keyword">class </font>CCXX_CLASS_EXPORT CRC16Digest;
00064 <font class="keyword">class </font>CCXX_CLASS_EXPORT MD5Digest;
00065 <font class="preprocessor">#endif</font>
00066 <font class="preprocessor"></font>
00074 <font class="preprocessor">#if defined(STLPORT) || defined(__KCC)</font>
00075 <font class="preprocessor"></font><font class="preprocessor">#define std::ostream std::ostream_withassign</font>
00076 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
<a name="l00077"></a><a class="code" href="classost_1_1_digest.html">00077</a> <font class="preprocessor"></font><font class="keyword">class </font>Digest : <font class="keyword">public</font> std::streambuf, <font class="keyword">public</font> std::ostream
00078 {
00079 <font class="keyword">protected</font>:
00080         <a class="code" href="classost_1_1_digest.html#b0">Digest</a>();
00081 
00085         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_digest.html#b1">initDigest</a>(<font class="keywordtype">void</font>) = 0;
00086 
00092         <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_digest.html#b2">getSize</a>(<font class="keywordtype">void</font>) = 0;
00093 
00100         <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_digest.html#b3">getDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer) = 0;
00101 
00108         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_digest.html#b4">putDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> length) = 0;
00109 
00115         <font class="keyword">virtual</font> <a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;<a class="code" href="classost_1_1_digest.html#b5">strDigest</a>(<a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;os) = 0;
00116 
<a name="l00117"></a><a class="code" href="classost_1_1_digest.html#l0">00117</a>         <font class="keyword">friend</font> <a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;<a class="code" href="classost_1_1_digest.html#l0">operator&lt;&lt;</a>(<a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;os, Digest &amp;ia)<font class="keyword"></font>
00118 <font class="keyword">                </font>{<font class="keywordflow">return</font> ia.strDigest(os);};
00119 };
00120 
<a name="l00127"></a><a class="code" href="classost_1_1_checksum_digest.html">00127</a> <font class="keyword">class </font>ChecksumDigest : <font class="keyword">public</font> Digest
00128 {
00129 <font class="keyword">private</font>:
00130         <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> csum;
00131 
00132 <font class="keyword">protected</font>:
00133         <font class="keywordtype">int</font> <a class="code" href="classost_1_1_checksum_digest.html#b0">overflow</a>(<font class="keywordtype">int</font> c);
00134         <a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;<a class="code" href="classost_1_1_checksum_digest.html#b1">strDigest</a>(<a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;os);
00135 
00136 <font class="keyword">public</font>:
00137         <a class="code" href="classost_1_1_checksum_digest.html#a0">ChecksumDigest</a>();
00138 
<a name="l00139"></a><a class="code" href="classost_1_1_checksum_digest.html#a1">00139</a>         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_checksum_digest.html#a1">initDigest</a>(<font class="keywordtype">void</font>)<font class="keyword"></font>
00140 <font class="keyword">                </font>{csum = 0;};
00141 
<a name="l00142"></a><a class="code" href="classost_1_1_checksum_digest.html#a2">00142</a>         <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_checksum_digest.html#a2">getSize</a>(<font class="keywordtype">void</font>)<font class="keyword"></font>
00143 <font class="keyword">                </font>{<font class="keywordflow">return</font> 1;};
00144 
00145         <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_checksum_digest.html#a3">getDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer);
00146 
00147         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_checksum_digest.html#a4">putDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> length);
00148 };
00149 
<a name="l00156"></a><a class="code" href="classost_1_1_c_r_c16_digest.html">00156</a> <font class="keyword">class </font>CRC16Digest : <font class="keyword">public</font> Digest
00157 {
00158 <font class="keyword">private</font>:
00159         <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> crc16;
00160 
00161 <font class="keyword">protected</font>:
00162         <font class="keywordtype">int</font> <a class="code" href="classost_1_1_c_r_c16_digest.html#b0">overflow</a>(<font class="keywordtype">int</font> c);
00163 
00164         <a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;<a class="code" href="classost_1_1_c_r_c16_digest.html#b1">strDigest</a>(<a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;os);
00165 
00166 <font class="keyword">public</font>:
00167         <a class="code" href="classost_1_1_c_r_c16_digest.html#a0">CRC16Digest</a>();
00168 
<a name="l00169"></a><a class="code" href="classost_1_1_c_r_c16_digest.html#a1">00169</a>         <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_c_r_c16_digest.html#a1">initDigest</a>(<font class="keywordtype">void</font>)<font class="keyword"></font>
00170 <font class="keyword">                </font>{crc16 = 0;};
00171 
<a name="l00172"></a><a class="code" href="classost_1_1_c_r_c16_digest.html#a2">00172</a>         <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_c_r_c16_digest.html#a2">getSize</a>(<font class="keywordtype">void</font>)<font class="keyword"></font>
00173 <font class="keyword">                </font>{<font class="keywordflow">return</font> 2;};
00174 
00175         <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_c_r_c16_digest.html#a3">getDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer);
00176 
00177         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_c_r_c16_digest.html#a4">putDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> length);
00178 };
00179 
<a name="l00186"></a><a class="code" href="classost_1_1_m_d5_digest.html">00186</a> <font class="keyword">class </font>MD5Digest : <font class="keyword">public</font> Digest
00187 {
00188 <font class="keyword">private</font>:
00189         <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> state[4];
00190         <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> count[2];
00191         <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> buf[64];
00192         <font class="keywordtype">unsigned</font> bpos;
00193         <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> md5[16];
00194         <font class="keywordtype">bool</font> updated;
00195 
00196 <font class="keyword">protected</font>:
00197         <font class="keywordtype">int</font> <a class="code" href="classost_1_1_m_d5_digest.html#b0">overflow</a>(<font class="keywordtype">int</font> c);
00198 
00199         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_m_d5_digest.html#b1">Update</a>(<font class="keywordtype">void</font>);
00200 
00201         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_m_d5_digest.html#b2">Commit</a>(<font class="keywordtype">void</font>);
00202 
00203         <a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;<a class="code" href="classost_1_1_m_d5_digest.html#b3">strDigest</a>(<a class="code" href="classstd_1_1ostream.html">std::ostream</a> &amp;os);
00204 
00205 <font class="keyword">public</font>:
00206         <a class="code" href="classost_1_1_m_d5_digest.html#a0">MD5Digest</a>();
00207 
00208         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_m_d5_digest.html#a1">initDigest</a>(<font class="keywordtype">void</font>);
00209 
<a name="l00210"></a><a class="code" href="classost_1_1_m_d5_digest.html#a2">00210</a>         <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_m_d5_digest.html#a2">getSize</a>(<font class="keywordtype">void</font>)<font class="keyword"></font>
00211 <font class="keyword">                </font>{<font class="keywordflow">return</font> 16;};
00212 
00213         <font class="keywordtype">unsigned</font> <a class="code" href="classost_1_1_m_d5_digest.html#a3">getDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer);
00214 
00215         <font class="keywordtype">void</font> <a class="code" href="classost_1_1_m_d5_digest.html#a4">putDigest</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> len);
00216 };
00217 
00218 <font class="preprocessor">#ifdef  CCXX_NAMESPACES</font>
00219 <font class="preprocessor"></font>};
00220 <font class="preprocessor">#endif</font>
00221 <font class="preprocessor"></font>
00222 <font class="preprocessor">#endif</font>
00223 <font class="preprocessor"></font>
</pre></div><hr><address><small>Generated at Fri Jan 4 18:51:45 2002 for CommonC++ by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.gif" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2001</small></address>
</body>
</html>