diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:13:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:13:10 +0000 |
commit | 3c57dd931145d43f2b0aef96c4d178135956bf91 (patch) | |
tree | 3de698981e9f0cc2c4f9569b19a5f3595e741f6b /libgimpmath/gimpmd5.c | |
parent | Initial commit. (diff) | |
download | gimp-3c57dd931145d43f2b0aef96c4d178135956bf91.tar.xz gimp-3c57dd931145d43f2b0aef96c4d178135956bf91.zip |
Adding upstream version 2.10.36.upstream/2.10.36
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | libgimpmath/gimpmd5.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libgimpmath/gimpmd5.c b/libgimpmath/gimpmd5.c new file mode 100644 index 0000000..712c3a9 --- /dev/null +++ b/libgimpmath/gimpmd5.c @@ -0,0 +1,53 @@ +/* LIBGIMP - The GIMP Library + * + * gimpmd5.c + * + * Use of this code is deprecated! Use %GChecksum from GLib instead. + */ + +#include "config.h" + +#include <glib-object.h> + +#include "gimpmathtypes.h" + +#include "gimpmd5.h" + + +/** + * SECTION: gimpmd5 + * @title: GimpMD5 + * @short_description: The MD5 message-digest algorithm + * + * The MD5 message-digest algorithm + **/ + + +/** + * 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, (const guchar *) buffer, buffer_size); + g_checksum_get_digest (checksum, digest, &len); + g_checksum_free (checksum); +} |