blob: 18b21a10fca52c52f443c578df24c7778159bf3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
<!-- ##### SECTION Title ##### -->
Data Checksums
<!-- ##### SECTION Short_Description ##### -->
Computes the checksum for data
<!-- ##### SECTION Long_Description ##### -->
<para>
GLib provides a generic API for computing checksums (or "digests") for a
sequence of arbitrary bytes, using various hashing algorithms like MD5,
SHA-1 and SHA-256. Checksums are commonly used in various environments and
specifications.
</para>
<para>
GLib supports incremental checksums using the GChecksum data structure, by
calling g_checksum_update() as long as there's data available and then using
g_checksum_get_string() or g_checksum_get_digest() to compute the checksum
and return it either as a string in hexadecimal form, or as a raw sequence
of bytes. To compute the checksum for binary blobs and NUL-terminated strings
in one go, use the convenience functions g_compute_checksum_for_data() and
g_compute_checksum_for_string(), respectively.
</para>
<para>
Support for checksums has been added in GLib 2.16
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### ENUM GChecksumType ##### -->
<para>
</para>
@G_CHECKSUM_MD5:
@G_CHECKSUM_SHA1:
@G_CHECKSUM_SHA256:
<!-- ##### FUNCTION g_checksum_type_get_length ##### -->
<para>
</para>
@checksum_type:
@Returns:
<!-- ##### STRUCT GChecksum ##### -->
<para>
</para>
<!-- ##### FUNCTION g_checksum_new ##### -->
<para>
</para>
@checksum_type:
@Returns:
<!-- ##### FUNCTION g_checksum_copy ##### -->
<para>
</para>
@checksum:
@Returns:
<!-- ##### FUNCTION g_checksum_free ##### -->
<para>
</para>
@checksum:
<!-- ##### FUNCTION g_checksum_update ##### -->
<para>
</para>
@checksum:
@data:
@length:
<!-- ##### FUNCTION g_checksum_get_string ##### -->
<para>
</para>
@checksum:
@Returns:
<!-- ##### FUNCTION g_checksum_get_digest ##### -->
<para>
</para>
@checksum:
@buffer:
@digest_len:
<!-- ##### FUNCTION g_compute_checksum_for_data ##### -->
<para>
</para>
@checksum_type:
@data:
@length:
@Returns:
<!-- ##### FUNCTION g_compute_checksum_for_string ##### -->
<para>
</para>
@checksum_type:
@str:
@length:
@Returns:
|