$darkmode
Elektra 0.11.0
|
Provides functions to hash Elektra data structures. More...
#include <kdb.h>
#include <kdbease.h>
#include <kdberrors.h>
#include <kdbtypes.h>
#include <stdio.h>
#include <string.h>
#include "sha-256.h"
Functions | |
kdb_boolean_t | calculateSpecificationToken (char hash_string[65], KeySet *ks, Key *parentKey) |
Calculate a specification token for the KeySet of an application. More... | |
Provides functions to hash Elektra data structures.
kdb_boolean_t calculateSpecificationToken | ( | char | hash_string[65], |
KeySet * | ks, | ||
Key * | parentKey | ||
) |
Calculate a specification token for the KeySet of an application.
The KeySet of an application is identified as all keys below the applications root key.
/format/#
) are ignored for the token. See inline documentation below for rationale.hash_string | A string. After successful execution this will contain the hash as hex-string. |
ks | The KeySet for the application. |
parentKey | The Key below which all the relevant keys are. Keys that are not below parentKey are ignored. The key's namespace is important (see preconditions) |
false | If an error occurred. |
true | If the computation was successful. |
Loop through all keys relevant for token calculation.
Ignore array parents for token calculation. Rationale: There is a bug in the spec plugin that is triggered on changing the size of an array. It leads to array parents vanishing from the spec namespace and thus a different token. See https://github.com/ElektraInitiative/libelektra/issues/4061
Include NULL teminator in this and all following key/value strings, to avoid the following bug: https://github.com/ElektraInitiative/libelektra/issues/4110