gimp/libgimpmath/gimpmd5.c
Sven Neumann 540d533bef removed implementation of the MD5 algorithm and delegate to GChecksum
2008-03-29  Sven Neumann  <sven@gimp.org>

	* libgimpmath/gimpmd5.[ch]: removed implementation of the MD5
	algorithm and delegate to GChecksum instead.
	
	* libgimpmath/Makefile.am
	* libgimpmath/test-md5.c: removed test of the MD5 
implementation.


svn path=/trunk/; revision=25302
2008-03-29 16:56:44 +00:00

44 lines
1 KiB
C

/* LIBGIMP - The GIMP Library
*
* gimpmd5.c
*
* Use of this code is deprecated! Use %GChecksum from GLib instead.
*/
#include "config.h"
#include <glib.h>
#undef GIMP_DISABLE_DEPRECATED
#include "gimpmd5.h"
/**
* gimp_md5_get_digest:
* @buffer: byte buffer
* @buffer_size: buffer size (in bytes) or -1 if @buffer is nul-terminated.
* @digest: 16 bytes buffer receiving the hash code.
*
* This function is deprecated! Use %GChecksum from GLib instead.
*
* Get the md5 hash of a buffer. The result is put in the 16 bytes
* buffer @digest. For more information see RFC 1321.
**/
void
gimp_md5_get_digest (const gchar *buffer,
gint buffer_size,
guchar digest[16])
{
GChecksum *checksum;
gsize len = 16;
g_return_if_fail (buffer != NULL);
g_return_if_fail (digest != NULL);
checksum = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (checksum, buffer, buffer_size);
g_checksum_get_digest (checksum, (const guchar *) digest, &len);
g_checksum_free (checksum);
}