Function

GLibcompute_checksum_for_data

since: 2.16

Declaration

gchar*
g_compute_checksum_for_data (
  GChecksumType checksum_type,
  const guchar* data,
  gsize length
)

Description

Computes the checksum for a binary data of length. This is a convenience wrapper for g_checksum_new(), g_checksum_get_string() and g_checksum_free().

The hexadecimal string returned will be in lower case.

Available since: 2.16

Parameters

checksum_type

Type: GChecksumType

A GChecksumType.

data

Type: An array of guint8

Binary blob to compute the digest of.

The length of the array is specified in the length argument.
The data is owned by the caller of the function.
length

Type: gsize

Length of data.

Return value

Type: gchar*

The digest of the binary data as a string in hexadecimal, or NULL if g_checksum_new() fails for checksum_type. The returned string should be freed with g_free() when done using it.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be NULL.
The value is a NUL terminated UTF-8 string.