Struct
GLibChecksum
since: 2.16
Description [src]
struct GChecksum {
/* No available fields */
}
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.
To create a new GChecksum, use g_checksum_new(). To free a GChecksum, use g_checksum_free().
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.
Available since: 2.16
Constructors
g_checksum_new
Creates a new GChecksum, using the checksum algorithm checksum_type.
If the checksum_type is not known, NULL is returned. A GChecksum can be used to compute the checksum, or digest, of an
arbitrary binary blob, using different hashing algorithms.
since: 2.16
Instance methods
g_checksum_copy
Copies a GChecksum. If checksum has been closed, by calling
g_checksum_get_string() or g_checksum_get_digest(), the copied
checksum will be closed as well.
since: 2.16
g_checksum_get_digest
Gets the digest from checksum as a raw binary vector and places it into buffer. The size of the digest depends on the type of checksum.
since: 2.16
g_checksum_update
Feeds data into an existing GChecksum. The checksum must still be
open, that is g_checksum_get_string() or g_checksum_get_digest() must
not have been called on checksum.
since: 2.16