|
Packit |
ae235b |
/* gchecksum.h - data hashing functions
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Copyright (C) 2007 Emmanuele Bassi <ebassi@gnome.org>
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is free software; you can redistribute it and/or
|
|
Packit |
ae235b |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
ae235b |
* License as published by the Free Software Foundation; either
|
|
Packit |
ae235b |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
ae235b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
ae235b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
ae235b |
* Lesser General Public License for more details.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
ae235b |
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#ifndef __G_CHECKSUM_H__
|
|
Packit |
ae235b |
#define __G_CHECKSUM_H__
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
|
Packit |
ae235b |
#error "Only <glib.h> can be included directly."
|
|
Packit |
ae235b |
#endif
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#include <glib/gtypes.h>
|
|
Packit |
ae235b |
#include <glib/gbytes.h>
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
G_BEGIN_DECLS
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GChecksumType:
|
|
Packit |
ae235b |
* @G_CHECKSUM_MD5: Use the MD5 hashing algorithm
|
|
Packit |
ae235b |
* @G_CHECKSUM_SHA1: Use the SHA-1 hashing algorithm
|
|
Packit |
ae235b |
* @G_CHECKSUM_SHA256: Use the SHA-256 hashing algorithm
|
|
Packit |
ae235b |
* @G_CHECKSUM_SHA384: Use the SHA-384 hashing algorithm (Since: 2.51)
|
|
Packit |
ae235b |
* @G_CHECKSUM_SHA512: Use the SHA-512 hashing algorithm (Since: 2.36)
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The hashing algorithm to be used by #GChecksum when performing the
|
|
Packit |
ae235b |
* digest of some data.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Note that the #GChecksumType enumeration may be extended at a later
|
|
Packit |
ae235b |
* date to include new hashing algorithm types.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.16
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef enum {
|
|
Packit |
ae235b |
G_CHECKSUM_MD5,
|
|
Packit |
ae235b |
G_CHECKSUM_SHA1,
|
|
Packit |
ae235b |
G_CHECKSUM_SHA256,
|
|
Packit |
ae235b |
G_CHECKSUM_SHA512,
|
|
Packit |
ae235b |
G_CHECKSUM_SHA384
|
|
Packit |
ae235b |
} GChecksumType;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GChecksum:
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* An opaque structure representing a checksumming operation.
|
|
Packit |
ae235b |
* To create a new GChecksum, use g_checksum_new(). To free
|
|
Packit |
ae235b |
* a GChecksum, use g_checksum_free().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.16
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef struct _GChecksum GChecksum;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gssize g_checksum_type_get_length (GChecksumType checksum_type);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GChecksum * g_checksum_new (GChecksumType checksum_type);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_checksum_reset (GChecksum *checksum);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GChecksum * g_checksum_copy (const GChecksum *checksum);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_checksum_free (GChecksum *checksum);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_checksum_update (GChecksum *checksum,
|
|
Packit |
ae235b |
const guchar *data,
|
|
Packit |
ae235b |
gssize length);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
const gchar * g_checksum_get_string (GChecksum *checksum);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_checksum_get_digest (GChecksum *checksum,
|
|
Packit |
ae235b |
guint8 *buffer,
|
|
Packit |
ae235b |
gsize *digest_len);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gchar *g_compute_checksum_for_data (GChecksumType checksum_type,
|
|
Packit |
ae235b |
const guchar *data,
|
|
Packit |
ae235b |
gsize length);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gchar *g_compute_checksum_for_string (GChecksumType checksum_type,
|
|
Packit |
ae235b |
const gchar *str,
|
|
Packit |
ae235b |
gssize length);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_2_34
|
|
Packit |
ae235b |
gchar *g_compute_checksum_for_bytes (GChecksumType checksum_type,
|
|
Packit |
ae235b |
GBytes *data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
G_END_DECLS
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#endif /* __G_CHECKSUM_H__ */
|