| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <title>Digests</title> |
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> |
| 7 | <link rel="home" href="index.html" title="Redland RDF Library Manual"> |
| 8 | <link rel="up" href="reference-manual.html" title="Part II. Reference Manual"> |
| 9 | <link rel="prev" href="redland-concepts.html" title="Concepts"> |
| 10 | <link rel="next" href="redland-files.html" title="Files"> |
| 11 | <meta name="generator" content="GTK-Doc V1.18 (XML mode)"> |
| 12 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 13 | </head> |
| 14 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 15 | <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> |
| 16 | <tr valign="middle"> |
| 17 | <td><a accesskey="p" href="redland-concepts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> |
| 18 | <td><a accesskey="u" href="reference-manual.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> |
| 19 | <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> |
| 20 | <th width="100%" align="center">Redland RDF Library Manual</th> |
| 21 | <td><a accesskey="n" href="redland-files.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> |
| 22 | </tr> |
| 23 | <tr><td colspan="5" class="shortcuts"> |
| 24 | <a href="#redland-digest.synopsis" class="shortcut">Top</a> |
| 25 | | |
| 26 | <a href="#redland-digest.description" class="shortcut">Description</a> |
| 27 | </td></tr> |
| 28 | </table> |
| 29 | <div class="refentry"> |
| 30 | <a name="redland-digest"></a><div class="titlepage"></div> |
| 31 | <div class="refnamediv"><table width="100%"><tr> |
| 32 | <td valign="top"> |
| 33 | <h2><span class="refentrytitle"><a name="redland-digest.top_of_page"></a>Digests</span></h2> |
| 34 | <p>Digests — Content digests.</p> |
| 35 | </td> |
| 36 | <td valign="top" align="right"></td> |
| 37 | </tr></table></div> |
| 38 | <div class="refsynopsisdiv"> |
| 39 | <a name="redland-digest.synopsis"></a><h2>Synopsis</h2> |
| 40 | <pre class="synopsis">typedef <a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest">librdf_digest</a>; |
| 41 | typedef <a class="link" href="redland-digest.html#librdf-digest-factory" title="librdf_digest_factory">librdf_digest_factory</a>; |
| 42 | <a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="returnvalue">librdf_digest</span></a> * <a class="link" href="redland-digest.html#librdf-new-digest" title="librdf_new_digest ()">librdf_new_digest</a> (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 43 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>); |
| 44 | <span class="returnvalue">void</span> <a class="link" href="redland-digest.html#librdf-free-digest" title="librdf_free_digest ()">librdf_free_digest</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>); |
| 45 | <span class="returnvalue">void</span> <a class="link" href="redland-digest.html#librdf-digest-init" title="librdf_digest_init ()">librdf_digest_init</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>); |
| 46 | <span class="returnvalue">void</span> <a class="link" href="redland-digest.html#librdf-digest-update" title="librdf_digest_update ()">librdf_digest_update</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>, |
| 47 | <em class="parameter"><code>const unsigned <span class="type">char</span> *buf</code></em>, |
| 48 | <em class="parameter"><code><span class="type">size_t</span> length</code></em>); |
| 49 | <span class="returnvalue">void</span> <a class="link" href="redland-digest.html#librdf-digest-update-string" title="librdf_digest_update_string ()">librdf_digest_update_string</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>, |
| 50 | <em class="parameter"><code>const unsigned <span class="type">char</span> *string</code></em>); |
| 51 | <span class="returnvalue">void</span> <a class="link" href="redland-digest.html#librdf-digest-final" title="librdf_digest_final ()">librdf_digest_final</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>); |
| 52 | <span class="returnvalue">void</span> * <a class="link" href="redland-digest.html#librdf-digest-get-digest" title="librdf_digest_get_digest ()">librdf_digest_get_digest</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>); |
| 53 | <span class="returnvalue">size_t</span> <a class="link" href="redland-digest.html#librdf-digest-get-digest-length" title="librdf_digest_get_digest_length ()">librdf_digest_get_digest_length</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>); |
| 54 | <span class="returnvalue">char</span> * <a class="link" href="redland-digest.html#librdf-digest-to-string" title="librdf_digest_to_string ()">librdf_digest_to_string</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>); |
| 55 | <span class="returnvalue">void</span> <a class="link" href="redland-digest.html#librdf-digest-print" title="librdf_digest_print ()">librdf_digest_print</a> (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>, |
| 56 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>); |
| 57 | </pre> |
| 58 | </div> |
| 59 | <div class="refsect1"> |
| 60 | <a name="redland-digest.description"></a><h2>Description</h2> |
| 61 | <p> |
| 62 | Create a message digest over a block of data. Includes implementations |
| 63 | of MD5, RMD160 and SHA1. |
| 64 | </p> |
| 65 | </div> |
| 66 | <div class="refsect1"> |
| 67 | <a name="redland-digest.details"></a><h2>Details</h2> |
| 68 | <div class="refsect2"> |
| 69 | <a name="librdf-digest"></a><h3>librdf_digest</h3> |
| 70 | <pre class="programlisting">typedef struct librdf_digest_s librdf_digest; |
| 71 | </pre> |
| 72 | <p> |
| 73 | Redland content digest class. |
| 74 | </p> |
| 75 | </div> |
| 76 | <hr> |
| 77 | <div class="refsect2"> |
| 78 | <a name="librdf-digest-factory"></a><h3>librdf_digest_factory</h3> |
| 79 | <pre class="programlisting">typedef struct librdf_digest_factory_s librdf_digest_factory; |
| 80 | </pre> |
| 81 | <p> |
| 82 | Redland digest factory class. |
| 83 | </p> |
| 84 | </div> |
| 85 | <hr> |
| 86 | <div class="refsect2"> |
| 87 | <a name="librdf-new-digest"></a><h3>librdf_new_digest ()</h3> |
| 88 | <pre class="programlisting"><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="returnvalue">librdf_digest</span></a> * librdf_new_digest (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 89 | <em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre> |
| 90 | <p> |
| 91 | Constructor - create a new <a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> object. |
| 92 | </p> |
| 93 | <p> |
| 94 | After construction, data should be added to the digest using |
| 95 | <a class="link" href="redland-digest.html#librdf-digest-update" title="librdf_digest_update ()"><span class="type">librdf_digest_update</span></a> or <a class="link" href="redland-digest.html#librdf-digest-update-string" title="librdf_digest_update_string ()"><span class="type">librdf_digest_update_string</span></a> with |
| 96 | <a class="link" href="redland-digest.html#librdf-digest-final" title="librdf_digest_final ()"><span class="type">librdf_digest_final</span></a> to signify finishing. Then the digest |
| 97 | value can be returned directly with <a class="link" href="redland-digest.html#librdf-digest-get-digest" title="librdf_digest_get_digest ()"><span class="type">librdf_digest_get_digest</span></a> |
| 98 | of <a class="link" href="redland-digest.html#librdf-digest-get-digest-length" title="librdf_digest_get_digest_length ()"><span class="type">librdf_digest_get_digest_length</span></a> bytes or as a hex encoded |
| 99 | string with <a class="link" href="redland-digest.html#librdf-digest-to-string" title="librdf_digest_to_string ()"><span class="type">librdf_digest_to_string</span></a>. The digest can be |
| 100 | re-initialised for new data with <a class="link" href="redland-digest.html#librdf-digest-init" title="librdf_digest_init ()"><span class="type">librdf_digest_init</span></a>. |
| 101 | </p> |
| 102 | <div class="variablelist"><table border="0"> |
| 103 | <col align="left" valign="top"> |
| 104 | <tbody> |
| 105 | <tr> |
| 106 | <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td> |
| 107 | <td>redland world object</td> |
| 108 | </tr> |
| 109 | <tr> |
| 110 | <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td> |
| 111 | <td>the digest name to use to create this digest</td> |
| 112 | </tr> |
| 113 | <tr> |
| 114 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 115 | <td>new <a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> object or NULL</td> |
| 116 | </tr> |
| 117 | </tbody> |
| 118 | </table></div> |
| 119 | </div> |
| 120 | <hr> |
| 121 | <div class="refsect2"> |
| 122 | <a name="librdf-free-digest"></a><h3>librdf_free_digest ()</h3> |
| 123 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_free_digest (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>);</pre> |
| 124 | <p> |
| 125 | Destructor - destroy a <a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> object. |
| 126 | </p> |
| 127 | <div class="variablelist"><table border="0"> |
| 128 | <col align="left" valign="top"> |
| 129 | <tbody><tr> |
| 130 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 131 | <td>the digest</td> |
| 132 | </tr></tbody> |
| 133 | </table></div> |
| 134 | </div> |
| 135 | <hr> |
| 136 | <div class="refsect2"> |
| 137 | <a name="librdf-digest-init"></a><h3>librdf_digest_init ()</h3> |
| 138 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_digest_init (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>);</pre> |
| 139 | <p> |
| 140 | (Re)initialise the librdf_digest object. |
| 141 | </p> |
| 142 | <p> |
| 143 | This is automatically called on construction but can be used to |
| 144 | re-initialise the digest to the initial state for digesting new |
| 145 | data. |
| 146 | </p> |
| 147 | <div class="variablelist"><table border="0"> |
| 148 | <col align="left" valign="top"> |
| 149 | <tbody><tr> |
| 150 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 151 | <td>the digest</td> |
| 152 | </tr></tbody> |
| 153 | </table></div> |
| 154 | </div> |
| 155 | <hr> |
| 156 | <div class="refsect2"> |
| 157 | <a name="librdf-digest-update"></a><h3>librdf_digest_update ()</h3> |
| 158 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_digest_update (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>, |
| 159 | <em class="parameter"><code>const unsigned <span class="type">char</span> *buf</code></em>, |
| 160 | <em class="parameter"><code><span class="type">size_t</span> length</code></em>);</pre> |
| 161 | <p> |
| 162 | Add more data to the librdf_digest object. |
| 163 | </p> |
| 164 | <div class="variablelist"><table border="0"> |
| 165 | <col align="left" valign="top"> |
| 166 | <tbody> |
| 167 | <tr> |
| 168 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 169 | <td>the digest</td> |
| 170 | </tr> |
| 171 | <tr> |
| 172 | <td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td> |
| 173 | <td>the data buffer</td> |
| 174 | </tr> |
| 175 | <tr> |
| 176 | <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| 177 | <td>the length of the data</td> |
| 178 | </tr> |
| 179 | </tbody> |
| 180 | </table></div> |
| 181 | </div> |
| 182 | <hr> |
| 183 | <div class="refsect2"> |
| 184 | <a name="librdf-digest-update-string"></a><h3>librdf_digest_update_string ()</h3> |
| 185 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_digest_update_string (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>, |
| 186 | <em class="parameter"><code>const unsigned <span class="type">char</span> *string</code></em>);</pre> |
| 187 | <p> |
| 188 | Add a string to the librdf_digest object. |
| 189 | </p> |
| 190 | <div class="variablelist"><table border="0"> |
| 191 | <col align="left" valign="top"> |
| 192 | <tbody> |
| 193 | <tr> |
| 194 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 195 | <td>the digest</td> |
| 196 | </tr> |
| 197 | <tr> |
| 198 | <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| 199 | <td>string to add</td> |
| 200 | </tr> |
| 201 | </tbody> |
| 202 | </table></div> |
| 203 | </div> |
| 204 | <hr> |
| 205 | <div class="refsect2"> |
| 206 | <a name="librdf-digest-final"></a><h3>librdf_digest_final ()</h3> |
| 207 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_digest_final (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>);</pre> |
| 208 | <p> |
| 209 | Finish the digesting of data. |
| 210 | </p> |
| 211 | <p> |
| 212 | The digest can now be returned via <a class="link" href="redland-digest.html#librdf-digest-get-digest" title="librdf_digest_get_digest ()"><code class="function">librdf_digest_get_digest()</code></a>. |
| 213 | </p> |
| 214 | <div class="variablelist"><table border="0"> |
| 215 | <col align="left" valign="top"> |
| 216 | <tbody><tr> |
| 217 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 218 | <td>the digest</td> |
| 219 | </tr></tbody> |
| 220 | </table></div> |
| 221 | </div> |
| 222 | <hr> |
| 223 | <div class="refsect2"> |
| 224 | <a name="librdf-digest-get-digest"></a><h3>librdf_digest_get_digest ()</h3> |
| 225 | <pre class="programlisting"><span class="returnvalue">void</span> * librdf_digest_get_digest (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>);</pre> |
| 226 | <p> |
| 227 | Get the calculated digested value. |
| 228 | </p> |
| 229 | <div class="variablelist"><table border="0"> |
| 230 | <col align="left" valign="top"> |
| 231 | <tbody> |
| 232 | <tr> |
| 233 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 234 | <td>the digest</td> |
| 235 | </tr> |
| 236 | <tr> |
| 237 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 238 | <td>pointer to the memory containing the digest. It will |
| 239 | be <a class="link" href="redland-digest.html#librdf-digest-get-digest-length" title="librdf_digest_get_digest_length ()"><span class="type">librdf_digest_get_digest_length</span></a> bytes in length.</td> |
| 240 | </tr> |
| 241 | </tbody> |
| 242 | </table></div> |
| 243 | </div> |
| 244 | <hr> |
| 245 | <div class="refsect2"> |
| 246 | <a name="librdf-digest-get-digest-length"></a><h3>librdf_digest_get_digest_length ()</h3> |
| 247 | <pre class="programlisting"><span class="returnvalue">size_t</span> librdf_digest_get_digest_length (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>);</pre> |
| 248 | <p> |
| 249 | Get length of the calculated digested. |
| 250 | </p> |
| 251 | <div class="variablelist"><table border="0"> |
| 252 | <col align="left" valign="top"> |
| 253 | <tbody> |
| 254 | <tr> |
| 255 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 256 | <td>the digest</td> |
| 257 | </tr> |
| 258 | <tr> |
| 259 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 260 | <td>size of the digest in bytes</td> |
| 261 | </tr> |
| 262 | </tbody> |
| 263 | </table></div> |
| 264 | </div> |
| 265 | <hr> |
| 266 | <div class="refsect2"> |
| 267 | <a name="librdf-digest-to-string"></a><h3>librdf_digest_to_string ()</h3> |
| 268 | <pre class="programlisting"><span class="returnvalue">char</span> * librdf_digest_to_string (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>);</pre> |
| 269 | <p> |
| 270 | Get a string representation of the digest object. |
| 271 | </p> |
| 272 | <div class="variablelist"><table border="0"> |
| 273 | <col align="left" valign="top"> |
| 274 | <tbody> |
| 275 | <tr> |
| 276 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 277 | <td>the digest</td> |
| 278 | </tr> |
| 279 | <tr> |
| 280 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 281 | <td>a newly allocated string that represents the digest. |
| 282 | This must be released by the caller using <a class="link" href="redland-general.html#librdf-free-memory" title="librdf_free_memory ()"><code class="function">librdf_free_memory()</code></a>.</td> |
| 283 | </tr> |
| 284 | </tbody> |
| 285 | </table></div> |
| 286 | </div> |
| 287 | <hr> |
| 288 | <div class="refsect2"> |
| 289 | <a name="librdf-digest-print"></a><h3>librdf_digest_print ()</h3> |
| 290 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_digest_print (<em class="parameter"><code><a class="link" href="redland-digest.html#librdf-digest" title="librdf_digest"><span class="type">librdf_digest</span></a> *digest</code></em>, |
| 291 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>);</pre> |
| 292 | <p> |
| 293 | Print the digest to a FILE handle. |
| 294 | </p> |
| 295 | <div class="variablelist"><table border="0"> |
| 296 | <col align="left" valign="top"> |
| 297 | <tbody> |
| 298 | <tr> |
| 299 | <td><p><span class="term"><em class="parameter"><code>digest</code></em> :</span></p></td> |
| 300 | <td>the digest</td> |
| 301 | </tr> |
| 302 | <tr> |
| 303 | <td><p><span class="term"><em class="parameter"><code>fh</code></em> :</span></p></td> |
| 304 | <td>file handle</td> |
| 305 | </tr> |
| 306 | </tbody> |
| 307 | </table></div> |
| 308 | </div> |
| 309 | </div> |
| 310 | </div> |
| 311 | <div class="footer"> |
| 312 | <hr> |
| 313 | Generated by GTK-Doc V1.18</div> |
| 314 | </body> |
| 315 | </html> |