MD5 Utility Functions
3
LIBEDATASERVER Library

# MD5 Utility Functions

Functions for manipulating MD5 checksums.

## Synopsis

                        MD5Context;
    void                md5_get_digest                      (const gchar *buffer,
                                                             gint buffer_size,
                                                             guchar digest[16]);
    void                md5_get_digest_from_file            (const gchar *filename,
                                                             guchar digest[16]);
    void                md5_init                            (MD5Context *ctx);
    void                md5_update                          (MD5Context *ctx,
                                                             const guchar *buf,
                                                             guint32 len);
    void                md5_final                           (MD5Context *ctx,
                                                             guchar digest[16]);

## Description

## Details

### MD5Context

    typedef struct {
    } MD5Context;

A buffer structure used for md5 calculation.

### md5_get_digest ()

    void                md5_get_digest                      (const gchar *buffer,
                                                             gint buffer_size,
                                                             guchar digest[16]);

Get the md5 hash of a buffer. The result is put in the 16 bytes buffer `digest` .

`buffer` :

  byte buffer

`buffer_size` :

  buffer size (in bytes)

`digest` :

  16 bytes buffer receiving the hash code.

### md5_get_digest_from_file ()

    void                md5_get_digest_from_file            (const gchar *filename,
                                                             guchar digest[16]);

Get the md5 hash of a file. The result is put in the 16 bytes buffer `digest` .

`filename` :

  file name

`digest` :

  16 bytes buffer receiving the hash code.

### md5_init ()

    void                md5_init                            (MD5Context *ctx);

Initialise an md5 buffer.

`ctx` :

  md5 context

### md5_update ()

    void                md5_update                          (MD5Context *ctx,
                                                             const guchar *buf,
                                                             guint32 len);

Update context to reflect the concatenation of another buffer full of bytes. Use this to progressively construct an md5 hash.

`ctx` :

  context object used for md5 computaion

`buf` :

  buffer to add

`len` :

  buffer length

### md5_final ()

    void                md5_final                           (MD5Context *ctx,
                                                             guchar digest[16]);

copy the final md5 hash to a bufer

`ctx` :

  context containing the calculated md5

`digest` :

  16 bytes buffer