Function

Fwupdguid_hash_string

Declaration [src]

gchar*
fwupd_guid_hash_string (
  const gchar* str
)

Description [src]

Returns a GUID for a given string. This uses a hash and so even small differences in the str will produce radically different return values.

The default implementation is taken from RFC4122, Section 4.1.3; specifically using a type-5 SHA-1 hash with a DNS namespace. The same result can be obtained with this simple python program:

#!/usr/bin/python import uuid print uuid.uuid5(uuid.NAMESPACE_DNS, ‘python.org’)

Available since:1.2.5

Parameters

str const gchar*
 

A source string to use as a key.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.

Return value

Returns: gchar*
 

A new GUID, or NULL if the string was invalid.

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