1 /* gchecksum.h - data hashing functions
3 * Copyright (C) 2007 Emmanuele Bassi <ebassi@gnome.org>
5 * SPDX-License-Identifier: LGPL-2.1-or-later
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef __G_CHECKSUM_H__
22 #define __G_CHECKSUM_H__
24 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
25 #error "Only <glib.h> can be included directly."
28 #include <glib/gtypes.h>
29 #include <glib/gbytes.h>
35 * @G_CHECKSUM_MD5: Use the MD5 hashing algorithm
36 * @G_CHECKSUM_SHA1: Use the SHA-1 hashing algorithm
37 * @G_CHECKSUM_SHA256: Use the SHA-256 hashing algorithm
38 * @G_CHECKSUM_SHA384: Use the SHA-384 hashing algorithm (Since: 2.51)
39 * @G_CHECKSUM_SHA512: Use the SHA-512 hashing algorithm (Since: 2.36)
41 * The hashing algorithm to be used by #GChecksum when performing the
42 * digest of some data.
44 * Note that the #GChecksumType enumeration may be extended at a later
45 * date to include new hashing algorithm types.
60 * An opaque structure representing a checksumming operation.
62 * To create a new GChecksum, use g_checksum_new(). To free
63 * a GChecksum, use g_checksum_free().
67 typedef struct _GChecksum GChecksum;
70 gssize g_checksum_type_get_length (GChecksumType checksum_type);
73 GChecksum * g_checksum_new (GChecksumType checksum_type);
75 void g_checksum_reset (GChecksum *checksum);
77 GChecksum * g_checksum_copy (const GChecksum *checksum);
79 void g_checksum_free (GChecksum *checksum);
81 void g_checksum_update (GChecksum *checksum,
85 const gchar * g_checksum_get_string (GChecksum *checksum);
87 void g_checksum_get_digest (GChecksum *checksum,
92 gchar *g_compute_checksum_for_data (GChecksumType checksum_type,
96 gchar *g_compute_checksum_for_string (GChecksumType checksum_type,
100 GLIB_AVAILABLE_IN_2_34
101 gchar *g_compute_checksum_for_bytes (GChecksumType checksum_type,
106 #endif /* __G_CHECKSUM_H__ */