The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Digests</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.71.0">
<link rel="start" href="index.html" title="Redland RDF Application Framework Manual">
<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference Manual">
<link rel="prev" href="redland-concepts.html" title="Concepts">
<link rel="next" href="redland-files.html" title="Files">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="redland.html" title="Redland Overview">
<link rel="chapter" href="introduction.html" title="Introduction">
<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference Manual">
<link rel="chapter" href="objects.html" title="Objects in C">
<link rel="index" href="ix01.html" title="Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="redland-concepts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Redland RDF Application Framework Manual</th>
<td><a accesskey="n" href="redland-files.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2558398" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2588977" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="redland-digest"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2558398"></a><span class="refentrytitle">Digests</span>
</h2>
<p>Digests &#8212; Content digests.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">



typedef     <a href="redland-digest.html#librdf-digest">librdf_digest</a>;
typedef     <a href="redland-digest.html#librdf-digest-factory">librdf_digest_factory</a>;
<a href="redland-digest.html#librdf-digest">librdf_digest</a>* <a href="redland-digest.html#librdf-new-digest">librdf_new_digest</a>            (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             const char *name);
void        <a href="redland-digest.html#librdf-free-digest">librdf_free_digest</a>              (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);
void        <a href="redland-digest.html#librdf-digest-init">librdf_digest_init</a>              (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);
void        <a href="redland-digest.html#librdf-digest-update">librdf_digest_update</a>            (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest,
                                             unsigned char *buf,
                                             size_t length);
void        <a href="redland-digest.html#librdf-digest-update-string">librdf_digest_update_string</a>     (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest,
                                             unsigned char *string);
void        <a href="redland-digest.html#librdf-digest-final">librdf_digest_final</a>             (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);
void*       <a href="redland-digest.html#librdf-digest-get-digest">librdf_digest_get_digest</a>        (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);
size_t      <a href="redland-digest.html#librdf-digest-get-digest-length">librdf_digest_get_digest_length</a> (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);
char*       <a href="redland-digest.html#librdf-digest-to-string">librdf_digest_to_string</a>         (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);
void        <a href="redland-digest.html#librdf-digest-print">librdf_digest_print</a>             (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest,
                                             FILE *fh);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2588977"></a><h2>Description</h2>
<p>
Create a message digest over a block of data.  Includes implementations
of MD5, RMD160 and SHA1.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2588994"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2589005"></a><h3>
<a name="librdf-digest"></a>librdf_digest</h3>
<a class="indexterm" name="id2589018"></a><pre class="programlisting">typedef struct librdf_digest_s librdf_digest;
</pre>
<p>
Redland content digest class.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589038"></a><h3>
<a name="librdf-digest-factory"></a>librdf_digest_factory</h3>
<a class="indexterm" name="id2589049"></a><pre class="programlisting">typedef struct librdf_digest_factory_s librdf_digest_factory;
</pre>
<p>
Redland digest factory class.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2589068"></a><h3>
<a name="librdf-new-digest"></a>librdf_new_digest ()</h3>
<a class="indexterm" name="id2589081"></a><pre class="programlisting"><a href="redland-digest.html#librdf-digest">librdf_digest</a>* librdf_new_digest            (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             const char *name);</pre>
<p>
Constructor - create a new <a href="redland-digest.html#librdf-digest"><span class="type">librdf_digest</span></a> object.
</p>
<p>
After construction, data should be added to the digest using
<a href="redland-digest.html#librdf-digest-update"><span class="type">librdf_digest_update</span></a> or <a href="redland-digest.html#librdf-digest-update-string"><span class="type">librdf_digest_update_string</span></a> with
<a href="redland-digest.html#librdf-digest-final"><span class="type">librdf_digest_final</span></a> to signify finishing.  Then the digest
value can be returned directly with <a href="redland-digest.html#librdf-digest-get-digest"><span class="type">librdf_digest_get_digest</span></a>
of <a href="redland-digest.html#librdf-digest-get-digest-length"><span class="type">librdf_digest_get_digest_length</span></a> bytes or as a hex encoded
string with <a href="redland-digest.html#librdf-digest-to-string"><span class="type">librdf_digest_to_string</span></a>.  The digest can be
re-initialised for new data with <a href="redland-digest.html#librdf-digest-init"><span class="type">librdf_digest_init</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>world</code></em>&#160;:</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>name</code></em>&#160;:</span></td>
<td> the digest name to use to create this digest
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> new <a href="redland-digest.html#librdf-digest"><span class="type">librdf_digest</span></a> object or NULL
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602086"></a><h3>
<a name="librdf-free-digest"></a>librdf_free_digest ()</h3>
<a class="indexterm" name="id2602098"></a><pre class="programlisting">void        librdf_free_digest              (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);</pre>
<p>
Destructor- destroy a <a href="redland-digest.html#librdf-digest"><span class="type">librdf_digest</span></a> object.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602154"></a><h3>
<a name="librdf-digest-init"></a>librdf_digest_init ()</h3>
<a class="indexterm" name="id2602166"></a><pre class="programlisting">void        librdf_digest_init              (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);</pre>
<p>
(Re)initialise the librdf_digest object.
</p>
<p>
This is automatically called on construction but can be used to
re-initialise the digest to the initial state for digesting new
data.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2502574"></a><h3>
<a name="librdf-digest-update"></a>librdf_digest_update ()</h3>
<a class="indexterm" name="id2502586"></a><pre class="programlisting">void        librdf_digest_update            (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest,
                                             unsigned char *buf,
                                             size_t length);</pre>
<p>
Add more data to the librdf_digest object.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></td>
<td> the data buffer
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> the length of the data
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2502677"></a><h3>
<a name="librdf-digest-update-string"></a>librdf_digest_update_string ()</h3>
<a class="indexterm" name="id2502688"></a><pre class="programlisting">void        librdf_digest_update_string     (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest,
                                             unsigned char *string);</pre>
<p>
Add a string to the librdf_digest object.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td> string to add
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2502760"></a><h3>
<a name="librdf-digest-final"></a>librdf_digest_final ()</h3>
<a class="indexterm" name="id2502772"></a><pre class="programlisting">void        librdf_digest_final             (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);</pre>
<p>
Finish the digesting of data.
</p>
<p>
The digest can now be returned via <a href="redland-digest.html#librdf-digest-get-digest"><code class="function">librdf_digest_get_digest()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2582212"></a><h3>
<a name="librdf-digest-get-digest"></a>librdf_digest_get_digest ()</h3>
<a class="indexterm" name="id2582224"></a><pre class="programlisting">void*       librdf_digest_get_digest        (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);</pre>
<p>
Get the calculated digested value.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> pointer to the memory containing the digest.  It will
be <a href="redland-digest.html#librdf-digest-get-digest-length"><span class="type">librdf_digest_get_digest_length</span></a> bytes in length.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2582291"></a><h3>
<a name="librdf-digest-get-digest-length"></a>librdf_digest_get_digest_length ()</h3>
<a class="indexterm" name="id2582302"></a><pre class="programlisting">size_t      librdf_digest_get_digest_length (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);</pre>
<p>
Get length of the calculated digested.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> size of the digest in bytes

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2582364"></a><h3>
<a name="librdf-digest-to-string"></a>librdf_digest_to_string ()</h3>
<a class="indexterm" name="id2582375"></a><pre class="programlisting">char*       librdf_digest_to_string         (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest);</pre>
<p>
Get a string representation of the digest object.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a newly allocated string that represents the digest.
This must be released by the caller using <code class="function">free()</code> 
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2582447"></a><h3>
<a name="librdf-digest-print"></a>librdf_digest_print ()</h3>
<a class="indexterm" name="id2582459"></a><pre class="programlisting">void        librdf_digest_print             (<a href="redland-digest.html#librdf-digest">librdf_digest</a> *digest,
                                             FILE *fh);</pre>
<p>
Print the digest to a FILE handle.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>digest</code></em>&#160;:</span></td>
<td> the digest
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>fh</code></em>&#160;:</span></td>
<td> file handle
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>