Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > e1990170655e25252b23301d6cebc16d > files > 1225

usrp-doc-3.3.0-8mdv2010.1.i586.rpm

<!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>Universal Software Radio Peripheral: md5.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.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>md5.h</h1><a href="md5_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* md5.h - Declaration of functions and data types used for MD5 sum</span>
<a name="l00002"></a>00002 <span class="comment">   computing library functions.</span>
<a name="l00003"></a>00003 <span class="comment">   Copyright (C) 1995, 1996, 1999, 2000, 2003 Free Software Foundation, Inc.</span>
<a name="l00004"></a>00004 <span class="comment">   NOTE: The canonical source of this file is maintained with the GNU C</span>
<a name="l00005"></a>00005 <span class="comment">   Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">   This program is free software; you can redistribute it and/or modify it</span>
<a name="l00008"></a>00008 <span class="comment">   under the terms of the GNU General Public License as published by the</span>
<a name="l00009"></a>00009 <span class="comment">   Free Software Foundation; either version 3, or (at your option) any</span>
<a name="l00010"></a>00010 <span class="comment">   later version.</span>
<a name="l00011"></a>00011 <span class="comment"></span>
<a name="l00012"></a>00012 <span class="comment">   This program is distributed in the hope that it will be useful,</span>
<a name="l00013"></a>00013 <span class="comment">   but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00014"></a>00014 <span class="comment">   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00015"></a>00015 <span class="comment">   GNU General Public License for more details.</span>
<a name="l00016"></a>00016 <span class="comment"></span>
<a name="l00017"></a>00017 <span class="comment">   You should have received a copy of the GNU General Public License</span>
<a name="l00018"></a>00018 <span class="comment">   along with this program; if not, write to the Free Software Foundation,</span>
<a name="l00019"></a>00019 <span class="comment">   Inc., 51 Franklin Street, Boston, MA 02110-1301, USA.  */</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef _MD5_H</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define _MD5_H 1</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;limits.h&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="comment">/* The following contortions are an attempt to use the C preprocessor</span>
<a name="l00028"></a>00028 <span class="comment">   to determine an unsigned integral type that is 32 bits wide.  An</span>
<a name="l00029"></a>00029 <span class="comment">   alternative approach is to use autoconf&#39;s AC_CHECK_SIZEOF macro, but</span>
<a name="l00030"></a>00030 <span class="comment">   doing that would require that the configure script compile and *run*</span>
<a name="l00031"></a>00031 <span class="comment">   the resulting executable.  Locally running cross-compiled executables</span>
<a name="l00032"></a>00032 <span class="comment">   is usually not possible.  */</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="preprocessor">#ifdef _LIBC</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor"># include &lt;stdint.h&gt;</span>
<a name="l00036"></a>00036 <span class="keyword">typedef</span> uint32_t md5_uint32;
<a name="l00037"></a>00037 <span class="keyword">typedef</span> uintptr_t <a class="code" href="md5_8h.html#a2d5490fb601446d2e2dd97ee021e6488">md5_uintptr</a>;
<a name="l00038"></a>00038 <span class="preprocessor">#else</span>
<a name="l00039"></a><a class="code" href="md5_8h.html#ab108c64f1909e7e25fe8f8d85acbe7d2">00039</a> <span class="preprocessor"></span><span class="preprocessor"># define UINT_MAX_32_BITS 4294967295U</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor"># if UINT_MAX == UINT_MAX_32_BITS</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>   <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> md5_uint32;
<a name="l00043"></a>00043 <span class="preprocessor"># else</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#  if USHRT_MAX == UINT_MAX_32_BITS</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>    <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> md5_uint32;
<a name="l00046"></a>00046 <span class="preprocessor">#  else</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#   if ULONG_MAX == UINT_MAX_32_BITS</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>     <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> md5_uint32;
<a name="l00049"></a>00049 <span class="preprocessor">#   else</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span>     <span class="comment">/* The following line is intended to evoke an error.</span>
<a name="l00051"></a>00051 <span class="comment">        Using #error is not portable enough.  */</span>
<a name="l00052"></a>00052      <span class="stringliteral">&quot;Cannot determine unsigned 32-bit data type.&quot;</span>
<a name="l00053"></a>00053 <span class="preprocessor">#   endif</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#  endif</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor"># endif</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="comment">/* We have to make a guess about the integer type equivalent in size</span>
<a name="l00057"></a>00057 <span class="comment">   to pointers which should always be correct.  */</span>
<a name="l00058"></a><a class="code" href="md5_8h.html#a2d5490fb601446d2e2dd97ee021e6488">00058</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="md5_8h.html#a2d5490fb601446d2e2dd97ee021e6488">md5_uintptr</a>;
<a name="l00059"></a>00059 <span class="preprocessor">#endif</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span>
<a name="l00061"></a>00061 <span class="comment">/* Structure to save state of computation between the single steps.  */</span>
<a name="l00062"></a><a class="code" href="structmd5__ctx.html">00062</a> <span class="keyword">struct </span><a class="code" href="structmd5__ctx.html">md5_ctx</a>
<a name="l00063"></a>00063 {
<a name="l00064"></a><a class="code" href="structmd5__ctx.html#ad3cd1fd0daca3d38ab6e12f27cb4f858">00064</a>   md5_uint32 <a class="code" href="structmd5__ctx.html#ad3cd1fd0daca3d38ab6e12f27cb4f858">A</a>;
<a name="l00065"></a><a class="code" href="structmd5__ctx.html#a0de0dd443b08898dcb19bdd20fd8e833">00065</a>   md5_uint32 <a class="code" href="structmd5__ctx.html#a0de0dd443b08898dcb19bdd20fd8e833">B</a>;
<a name="l00066"></a><a class="code" href="structmd5__ctx.html#a6ee98f3e18acd7f675ea33e23eb1554f">00066</a>   md5_uint32 <a class="code" href="structmd5__ctx.html#a6ee98f3e18acd7f675ea33e23eb1554f">C</a>;
<a name="l00067"></a><a class="code" href="structmd5__ctx.html#ae082f2d10560f0d0280c4e99d8a9d16e">00067</a>   md5_uint32 <a class="code" href="structmd5__ctx.html#ae082f2d10560f0d0280c4e99d8a9d16e">D</a>;
<a name="l00068"></a>00068 
<a name="l00069"></a><a class="code" href="structmd5__ctx.html#a508f7d5c0d85800ebfece4c77c30f18e">00069</a>   md5_uint32 <a class="code" href="structmd5__ctx.html#a508f7d5c0d85800ebfece4c77c30f18e">total</a>[2];
<a name="l00070"></a><a class="code" href="structmd5__ctx.html#a6d8795406395423360fbdc14b1d03935">00070</a>   md5_uint32 <a class="code" href="structmd5__ctx.html#a6d8795406395423360fbdc14b1d03935">buflen</a>;
<a name="l00071"></a><a class="code" href="structmd5__ctx.html#a4c74de4caa754d695d9af448d93d8789">00071</a>   <span class="keywordtype">char</span> <a class="code" href="structmd5__ctx.html#a4c74de4caa754d695d9af448d93d8789">buffer</a>[128];
<a name="l00072"></a>00072 };
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 <span class="comment">/*</span>
<a name="l00075"></a>00075 <span class="comment"> * The following three functions are build up the low level used in</span>
<a name="l00076"></a>00076 <span class="comment"> * the functions `md5_stream&#39; and `md5_buffer&#39;.</span>
<a name="l00077"></a>00077 <span class="comment"> */</span>
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <span class="comment">/* Initialize structure containing state of computation.</span>
<a name="l00080"></a>00080 <span class="comment">   (RFC 1321, 3.3: Step 3)  */</span>
<a name="l00081"></a>00081 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="md5_8h.html#ac3ac4bf337ea2ebffcecb83d4533f877">md5_init_ctx</a> (<span class="keyword">struct</span> <a class="code" href="structmd5__ctx.html">md5_ctx</a> *ctx);
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 <span class="comment">/* Starting with the result of former calls of this function (or the</span>
<a name="l00084"></a>00084 <span class="comment">   initialization function update the context for the next LEN bytes</span>
<a name="l00085"></a>00085 <span class="comment">   starting at BUFFER.</span>
<a name="l00086"></a>00086 <span class="comment">   It is necessary that LEN is a multiple of 64!!! */</span>
<a name="l00087"></a>00087 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="md5_8h.html#a78c2ce6f92cc655c1e00dcb1d42d2073">md5_process_block</a> (<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> len,
<a name="l00088"></a>00088                                <span class="keyword">struct</span> <a class="code" href="structmd5__ctx.html">md5_ctx</a> *ctx);
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 <span class="comment">/* Starting with the result of former calls of this function (or the</span>
<a name="l00091"></a>00091 <span class="comment">   initialization function update the context for the next LEN bytes</span>
<a name="l00092"></a>00092 <span class="comment">   starting at BUFFER.</span>
<a name="l00093"></a>00093 <span class="comment">   It is NOT required that LEN is a multiple of 64.  */</span>
<a name="l00094"></a>00094 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="md5_8h.html#a2167ee252f9d864c15739ad707f9c88e">md5_process_bytes</a> (<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> len,
<a name="l00095"></a>00095                                <span class="keyword">struct</span> <a class="code" href="structmd5__ctx.html">md5_ctx</a> *ctx);
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="comment">/* Process the remaining bytes in the buffer and put result from CTX</span>
<a name="l00098"></a>00098 <span class="comment">   in first 16 bytes following RESBUF.  The result is always in little</span>
<a name="l00099"></a>00099 <span class="comment">   endian byte order, so that a byte-wise output yields to the wanted</span>
<a name="l00100"></a>00100 <span class="comment">   ASCII representation of the message digest.</span>
<a name="l00101"></a>00101 <span class="comment"></span>
<a name="l00102"></a>00102 <span class="comment">   IMPORTANT: On some systems it is required that RESBUF be correctly</span>
<a name="l00103"></a>00103 <span class="comment">   aligned for a 32 bits value.  */</span>
<a name="l00104"></a>00104 <span class="keyword">extern</span> <span class="keywordtype">void</span> *<a class="code" href="md5_8h.html#afb354a896f5c60f65a937a95f15ee7b7">md5_finish_ctx</a> (<span class="keyword">struct</span> <a class="code" href="structmd5__ctx.html">md5_ctx</a> *ctx, <span class="keywordtype">void</span> *resbuf);
<a name="l00105"></a>00105 
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 <span class="comment">/* Put result from CTX in first 16 bytes following RESBUF.  The result is</span>
<a name="l00108"></a>00108 <span class="comment">   always in little endian byte order, so that a byte-wise output yields</span>
<a name="l00109"></a>00109 <span class="comment">   to the wanted ASCII representation of the message digest.</span>
<a name="l00110"></a>00110 <span class="comment"></span>
<a name="l00111"></a>00111 <span class="comment">   IMPORTANT: On some systems it is required that RESBUF is correctly</span>
<a name="l00112"></a>00112 <span class="comment">   aligned for a 32 bits value.  */</span>
<a name="l00113"></a>00113 <span class="keyword">extern</span> <span class="keywordtype">void</span> *<a class="code" href="md5_8h.html#ae7623dfff218108d16026127ca6edf31">md5_read_ctx</a> (<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structmd5__ctx.html">md5_ctx</a> *ctx, <span class="keywordtype">void</span> *resbuf);
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 
<a name="l00116"></a>00116 <span class="comment">/* Compute MD5 message digest for bytes read from STREAM.  The</span>
<a name="l00117"></a>00117 <span class="comment">   resulting message digest number will be written into the 16 bytes</span>
<a name="l00118"></a>00118 <span class="comment">   beginning at RESBLOCK.  */</span>
<a name="l00119"></a>00119 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="md5_8h.html#a59105467b3fc9dc939e92f16836341b4">md5_stream</a> (FILE *stream, <span class="keywordtype">void</span> *resblock);
<a name="l00120"></a>00120 
<a name="l00121"></a>00121 <span class="comment">/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The</span>
<a name="l00122"></a>00122 <span class="comment">   result is always in little endian byte order, so that a byte-wise</span>
<a name="l00123"></a>00123 <span class="comment">   output yields to the wanted ASCII representation of the message</span>
<a name="l00124"></a>00124 <span class="comment">   digest.  */</span>
<a name="l00125"></a>00125 <span class="keyword">extern</span> <span class="keywordtype">void</span> *<a class="code" href="md5_8h.html#a62c2b951082f4e72c1e09732dd087c86">md5_buffer</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> len, <span class="keywordtype">void</span> *resblock);
<a name="l00126"></a>00126 
<a name="l00127"></a><a class="code" href="md5_8h.html#a28f59d6cc7ca29725b37efd74f235ccb">00127</a> <span class="preprocessor">#define rol(x,n) ( ((x) &lt;&lt; (n)) | ((x) &gt;&gt; (32-(n))) )</span>
<a name="l00128"></a>00128 <span class="preprocessor"></span>
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Dec 29 19:44:19 2010 for Universal Software Radio Peripheral by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>