Current File : //opt/RZruby/share/doc/ruby/html/da/db0/md5_8h_source.html
<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Ruby: ext/digest/md5/md5.h Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Ruby
   &#160;<span id="projectnumber">1.9.3p551(2014-11-13revision48407)</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
      <li><a href="../../globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_31cedd4509e06940f559c1ca2f722e02.html">ext</a></li><li class="navelem"><a class="el" href="../../dir_8462c367d9e69a7809faa14633ccfafa.html">digest</a></li><li class="navelem"><a class="el" href="../../dir_c5cc402a4096417b851f14ae1ee53773.html">md5</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">md5.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../da/db0/md5_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">  Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">  This software is provided &#39;as-is&#39;, without any express or implied</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">  warranty.  In no event will the authors be held liable for any damages</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">  arising from the use of this software.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">  Permission is granted to anyone to use this software for any purpose,</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">  including commercial applications, and to alter it and redistribute it</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">  freely, subject to the following restrictions:</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">  1. The origin of this software must not be misrepresented; you must not</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">     claim that you wrote the original software. If you use this software</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">     in a product, an acknowledgment in the product documentation would be</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">     appreciated but is not required.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">  2. Altered source versions must be plainly marked as such, and must not be</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">     misrepresented as being the original software.</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">  3. This notice may not be removed or altered from any source distribution.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">  L. Peter Deutsch</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">  ghost@aladdin.com</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">  Independent implementation of MD5 (RFC 1321).</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">  This code implements the MD5 Algorithm defined in RFC 1321.</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">  It is derived directly from the text of the RFC and not from the</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">  reference implementation.</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">  The original and principal author of md5.h is L. Peter Deutsch</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">  &lt;ghost@aladdin.com&gt;.  Other authors are noted in the change history</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment">  that follows (in reverse chronological order):</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">  1999-11-04 lpd Edited comments slightly for automatic TOC extraction.</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment">  1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment">        added conditionalization for C++ compilation from Martin</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">        Purschke &lt;purschke@bnl.gov&gt;.</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">  1999-05-03 lpd Original version.</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">/* $OrigId: md5.h,v 1.2 2001/03/26 08:57:14 matz Exp $ */</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">/* $RoughId: md5.h,v 1.3 2002/02/24 08:14:31 knu Exp $ */</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">/* $Id: md5.h 25189 2009-10-02 12:04:37Z akr $ */</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor">#ifndef MD5_INCLUDED</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#  define MD5_INCLUDED</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="../../d5/d64/defs_8h.html">defs.h</a>&quot;</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment"> * This code has some adaptations for the Ghostscript environment, but it</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment"> * will compile and run correctly in any environment with 8-bit chars and</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment"> * 32-bit ints.  Specifically, it assumes that if the following are</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment"> * defined, they have the same meaning as in Ghostscript: P1, P2, P3.</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">/* Define the state of the MD5 Algorithm. */</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="../../d8/d22/structmd5__state__s.html">   59</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="../../d8/d22/structmd5__state__s.html">md5_state_s</a> {</div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="../../d8/d22/structmd5__state__s.html#a3892b636e0283710c424219143e0c658">   60</a></span>&#160;    <a class="code" href="../../db/d4d/sha2_8h.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> <a class="code" href="../../d8/d22/structmd5__state__s.html#a3892b636e0283710c424219143e0c658">count</a>[2];  <span class="comment">/* message length in bits, lsw first */</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="../../d8/d22/structmd5__state__s.html#abf7ef6da381be714a56330df63e244ed">   61</a></span>&#160;    <a class="code" href="../../db/d4d/sha2_8h.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> <a class="code" href="../../d5/d1d/gb18030_8c.html#a89f234133d3efe315836311cbf21c64b">state</a>[4];  <span class="comment">/* digest buffer */</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="../../d8/d22/structmd5__state__s.html#ad04819954f9f485392779beaf1b360d6">   62</a></span>&#160;    <a class="code" href="../../db/d4d/sha2_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="../../d8/d22/structmd5__state__s.html#ad04819954f9f485392779beaf1b360d6">buffer</a>[64]; <span class="comment">/* accumulate block */</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;} <a class="code" href="../../da/db0/md5_8h.html#a07e9e732033dd03615a64635f1182e43">MD5_CTX</a>;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">#ifdef RUBY</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="preprocessor"></span><span class="comment">/* avoid name clash */</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#define MD5_Init        rb_Digest_MD5_Init</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MD5_Update      rb_Digest_MD5_Update</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MD5_Finish      rb_Digest_MD5_Finish</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="keywordtype">void</span>    <a class="code" href="../../d7/d6c/md5_8c.html#a1afcb9eb34bec2165e342f3b2eeb06de">MD5_Init</a> <a class="code" href="../../df/da8/dln_8h.html#a10087a068d10eaadb8f9bb9200cd619a">_</a>((<a class="code" href="../../d8/d22/structmd5__state__s.html">MD5_CTX</a> *pms));</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="keywordtype">void</span>    <a class="code" href="../../d7/d6c/md5_8c.html#ad4644f19c3c46a544d3b5d3a94b8155f">MD5_Update</a> <a class="code" href="../../df/da8/dln_8h.html#a10087a068d10eaadb8f9bb9200cd619a">_</a>((<a class="code" href="../../d8/d22/structmd5__state__s.html">MD5_CTX</a> *pms, <span class="keyword">const</span> <a class="code" href="../../db/d4d/sha2_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *<a class="code" href="../../dd/dfb/yaml2byte_8c.html#a735984d41155bc1032e09bece8f8d66d">data</a>, <span class="keywordtype">size_t</span> nbytes));</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="keywordtype">void</span>    <a class="code" href="../../d7/d6c/md5_8c.html#a2f3caa8f774b2def6cb061afcd8b5602">MD5_Finish</a> <a class="code" href="../../df/da8/dln_8h.html#a10087a068d10eaadb8f9bb9200cd619a">_</a>((<a class="code" href="../../d8/d22/structmd5__state__s.html">MD5_CTX</a> *pms, <a class="code" href="../../db/d4d/sha2_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *digest));</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="../../da/db0/md5_8h.html#a76737295cb27913dc20024097f782c0f">   76</a></span>&#160;<span class="preprocessor">#define MD5_BLOCK_LENGTH                64</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="../../da/db0/md5_8h.html#a09a4f4b2f28cbe522d9b80153666029c">   77</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MD5_DIGEST_LENGTH               16</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="../../da/db0/md5_8h.html#ab7d658b118c653d9a61ef6adde6a80c7">   78</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MD5_DIGEST_STRING_LENGTH        (MD5_DIGEST_LENGTH * 2 + 1)</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* MD5_INCLUDED */</span><span class="preprocessor"></span></div>
<div class="ttc" id="structmd5__state__s_html"><div class="ttname"><a href="../../d8/d22/structmd5__state__s.html">md5_state_s</a></div><div class="ttdef"><b>Definition:</b> <a href="../../da/db0/md5_8h_source.html#l00059">md5.h:59</a></div></div>
<div class="ttc" id="structmd5__state__s_html_ad04819954f9f485392779beaf1b360d6"><div class="ttname"><a href="../../d8/d22/structmd5__state__s.html#ad04819954f9f485392779beaf1b360d6">md5_state_s::buffer</a></div><div class="ttdeci">uint8_t buffer[64]</div><div class="ttdef"><b>Definition:</b> <a href="../../da/db0/md5_8h_source.html#l00062">md5.h:62</a></div></div>
<div class="ttc" id="defs_8h_html"><div class="ttname"><a href="../../d5/d64/defs_8h.html">defs.h</a></div></div>
<div class="ttc" id="sha2_8h_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="../../db/d4d/sha2_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> <a href="../../db/d4d/sha2_8h_source.html#l00100">sha2.h:100</a></div></div>
<div class="ttc" id="yaml2byte_8c_html_a735984d41155bc1032e09bece8f8d66d"><div class="ttname"><a href="../../dd/dfb/yaml2byte_8c.html#a735984d41155bc1032e09bece8f8d66d">data</a></div><div class="ttdeci">void * data</div><div class="ttdef"><b>Definition:</b> <a href="../../dd/dfb/yaml2byte_8c_source.html#l00131">yaml2byte.c:131</a></div></div>
<div class="ttc" id="md5_8c_html_a1afcb9eb34bec2165e342f3b2eeb06de"><div class="ttname"><a href="../../d7/d6c/md5_8c.html#a1afcb9eb34bec2165e342f3b2eeb06de">MD5_Init</a></div><div class="ttdeci">void MD5_Init(MD5_CTX *pms)</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d6c/md5_8c_source.html#l00354">md5.c:354</a></div></div>
<div class="ttc" id="md5_8c_html_ad4644f19c3c46a544d3b5d3a94b8155f"><div class="ttname"><a href="../../d7/d6c/md5_8c.html#ad4644f19c3c46a544d3b5d3a94b8155f">MD5_Update</a></div><div class="ttdeci">void MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d6c/md5_8c_source.html#l00364">md5.c:364</a></div></div>
<div class="ttc" id="md5_8c_html_a2f3caa8f774b2def6cb061afcd8b5602"><div class="ttname"><a href="../../d7/d6c/md5_8c.html#a2f3caa8f774b2def6cb061afcd8b5602">MD5_Finish</a></div><div class="ttdeci">void MD5_Finish(MD5_CTX *pms, uint8_t *digest)</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d6c/md5_8c_source.html#l00402">md5.c:402</a></div></div>
<div class="ttc" id="dln_8h_html_a10087a068d10eaadb8f9bb9200cd619a"><div class="ttname"><a href="../../df/da8/dln_8h.html#a10087a068d10eaadb8f9bb9200cd619a">_</a></div><div class="ttdeci">#define _(args)</div><div class="ttdef"><b>Definition:</b> <a href="../../df/da8/dln_8h_source.html#l00028">dln.h:28</a></div></div>
<div class="ttc" id="gb18030_8c_html_a89f234133d3efe315836311cbf21c64b"><div class="ttname"><a href="../../d5/d1d/gb18030_8c.html#a89f234133d3efe315836311cbf21c64b">state</a></div><div class="ttdeci">state</div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d1d/gb18030_8c_source.html#l00213">gb18030.c:213</a></div></div>
<div class="ttc" id="structmd5__state__s_html_a3892b636e0283710c424219143e0c658"><div class="ttname"><a href="../../d8/d22/structmd5__state__s.html#a3892b636e0283710c424219143e0c658">md5_state_s::count</a></div><div class="ttdeci">uint32_t count[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../da/db0/md5_8h_source.html#l00060">md5.h:60</a></div></div>
<div class="ttc" id="sha2_8h_html_a435d1572bf3f880d55459d9805097f62"><div class="ttname"><a href="../../db/d4d/sha2_8h.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a></div><div class="ttdeci">unsigned int uint32_t</div><div class="ttdef"><b>Definition:</b> <a href="../../db/d4d/sha2_8h_source.html#l00101">sha2.h:101</a></div></div>
<div class="ttc" id="md5_8h_html_a07e9e732033dd03615a64635f1182e43"><div class="ttname"><a href="../../da/db0/md5_8h.html#a07e9e732033dd03615a64635f1182e43">MD5_CTX</a></div><div class="ttdeci">struct md5_state_s MD5_CTX</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>