1 /*
2  * Distributed under the Boost Software License, Version 1.0.
3  *    (See accompanying file LICENSE_1_0.txt or copy at
4  *          http://www.boost.org/LICENSE_1_0.txt)
5  */
6 module glib.gchecksum;
7 
8 import glib.gtypes;
9 import glib.garray;
10 import glib.gbytes;
11 
12 
13 enum GChecksumType {
14   G_CHECKSUM_MD5,
15   G_CHECKSUM_SHA1,
16   G_CHECKSUM_SHA256,
17   G_CHECKSUM_SHA512
18 }
19 
20 
21 struct GChecksum;
22 
23 
24 extern (C) {
25 
26     gssize        g_checksum_type_get_length    (GChecksumType checksum_type);
27 
28 
29     GChecksum *   g_checksum_new                (GChecksumType checksum_type);
30 
31     void          g_checksum_reset              (GChecksum *checksum);
32 
33     GChecksum *   g_checksum_copy               (const(GChecksum) *checksum);
34 
35     void          g_checksum_free               (GChecksum *checksum);
36 
37     void          g_checksum_update             (GChecksum *checksum,
38                                                  const(guchar) *data,
39                                                  gssize length);
40 
41     const(gchar) * g_checksum_get_string         (GChecksum *checksum);
42 
43     void          g_checksum_get_digest         (GChecksum *checksum,
44                                                  guint8 *buffer,
45                                                  gsize *digest_len);
46 
47 
48     gchar        *g_compute_checksum_for_data   (GChecksumType checksum_type,
49                                                  const(guchar) *data,
50                                                  gsize length);
51 
52     gchar        *g_compute_checksum_for_string (GChecksumType checksum_type,
53                                                  const(gchar) *str,
54                                                  gssize length);
55 
56 
57     gchar        *g_compute_checksum_for_bytes  (GChecksumType checksum_type,
58                                                  GBytes *data);
59 }