Function

GLibcompute_checksum_for_string

since: 2.16

Declaration [src]

gchar*
g_compute_checksum_for_string (
  GChecksumType checksum_type,
  const gchar* str,
  gssize length
)

Description [src]

Computes the checksum of a string.

The hexadecimal string returned will be in lower case.

Available since: 2.16

Parameters

checksum_type

Type: GChecksumType

A GChecksumType.

str

Type: const gchar*

The string to compute the checksum of.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
length

Type: gssize

The length of the string, or -1 if the string is null-terminated.

Return value

Type: gchar*

The checksum as a hexadecimal string, 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.