<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libedataserver-md5-utils">
<refmeta>
<refentrytitle role="top_of_page">MD5 Utility Functions</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBEDATASERVER Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>MD5 Utility Functions</refname>
<refpurpose>Functions for manipulating MD5 checksums.</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>



            <link linkend="MD5Context">MD5Context</link>;
<link linkend="void">void</link>        <link linkend="md5-get-digest">md5_get_digest</link>                  (const <link linkend="gchar">gchar</link> *buffer,
                                             <link linkend="gint">gint</link> buffer_size,
                                             <link linkend="guchar">guchar</link> digest[16]);
<link linkend="void">void</link>        <link linkend="md5-get-digest-from-file">md5_get_digest_from_file</link>        (const <link linkend="gchar">gchar</link> *filename,
                                             <link linkend="guchar">guchar</link> digest[16]);
<link linkend="void">void</link>        <link linkend="md5-init">md5_init</link>                        (<link linkend="MD5Context">MD5Context</link> *ctx);
<link linkend="void">void</link>        <link linkend="md5-update">md5_update</link>                      (<link linkend="MD5Context">MD5Context</link> *ctx,
                                             const <link linkend="guchar">guchar</link> *buf,
                                             <link linkend="guint32">guint32</link> len);
<link linkend="void">void</link>        <link linkend="md5-final">md5_final</link>                       (<link linkend="MD5Context">MD5Context</link> *ctx,
                                             <link linkend="guchar">guchar</link> digest[16]);
</synopsis>
</refsynopsisdiv>









<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="MD5Context" role="struct"/>MD5Context</title>
<indexterm><primary>MD5Context</primary></indexterm><programlisting>typedef struct {
} MD5Context;
</programlisting>
<para>
A buffer structure used for md5 calculation.</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="md5-get-digest" role="function"/>md5_get_digest ()</title>
<indexterm><primary>md5_get_digest</primary></indexterm><programlisting><link linkend="void">void</link>        md5_get_digest                  (const <link linkend="gchar">gchar</link> *buffer,
                                             <link linkend="gint">gint</link> buffer_size,
                                             <link linkend="guchar">guchar</link> digest[16]);</programlisting>
<para>
Get the md5 hash of a buffer. The result is put in 
the 16 bytes buffer <parameter>digest</parameter> .</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> byte buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer_size</parameter>&nbsp;:</term>
<listitem><simpara> buffer size (in bytes)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>digest</parameter>&nbsp;:</term>
<listitem><simpara> 16 bytes buffer receiving the hash code.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="md5-get-digest-from-file" role="function"/>md5_get_digest_from_file ()</title>
<indexterm><primary>md5_get_digest_from_file</primary></indexterm><programlisting><link linkend="void">void</link>        md5_get_digest_from_file        (const <link linkend="gchar">gchar</link> *filename,
                                             <link linkend="guchar">guchar</link> digest[16]);</programlisting>
<para>
Get the md5 hash of a file. The result is put in 
the 16 bytes buffer <parameter>digest</parameter> .</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
<listitem><simpara> file name
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>digest</parameter>&nbsp;:</term>
<listitem><simpara> 16 bytes buffer receiving the hash code.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="md5-init" role="function"/>md5_init ()</title>
<indexterm><primary>md5_init</primary></indexterm><programlisting><link linkend="void">void</link>        md5_init                        (<link linkend="MD5Context">MD5Context</link> *ctx);</programlisting>
<para>
Initialise an md5 buffer.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ctx</parameter>&nbsp;:</term>
<listitem><simpara> md5 context 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="md5-update" role="function"/>md5_update ()</title>
<indexterm><primary>md5_update</primary></indexterm><programlisting><link linkend="void">void</link>        md5_update                      (<link linkend="MD5Context">MD5Context</link> *ctx,
                                             const <link linkend="guchar">guchar</link> *buf,
                                             <link linkend="guint32">guint32</link> len);</programlisting>
<para>
Update context to reflect the concatenation of another buffer full
of bytes. Use this to progressively construct an md5 hash.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ctx</parameter>&nbsp;:</term>
<listitem><simpara> context object used for md5 computaion
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buf</parameter>&nbsp;:</term>
<listitem><simpara> buffer to add
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&nbsp;:</term>
<listitem><simpara> buffer length
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="md5-final" role="function"/>md5_final ()</title>
<indexterm><primary>md5_final</primary></indexterm><programlisting><link linkend="void">void</link>        md5_final                       (<link linkend="MD5Context">MD5Context</link> *ctx,
                                             <link linkend="guchar">guchar</link> digest[16]);</programlisting>
<para>
copy the final md5 hash to a bufer</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ctx</parameter>&nbsp;:</term>
<listitem><simpara> context containing the calculated md5
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>digest</parameter>&nbsp;:</term>
<listitem><simpara> 16 bytes buffer
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
