diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-16 15:05:29 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-16 15:05:29 +0100 |
commit | 7815ced57e8849465e9d821ea8c8e9d705efd0ca (patch) | |
tree | 79267034ca0b0986e70d974d418d9c9d13135261 /src/util | |
parent | 157efff4973ed4e6837fabd5e7397cc6e578d9a0 (diff) | |
download | anastasis-7815ced57e8849465e9d821ea8c8e9d705efd0ca.tar.gz anastasis-7815ced57e8849465e9d821ea8c8e9d705efd0ca.tar.bz2 anastasis-7815ced57e8849465e9d821ea8c8e9d705efd0ca.zip |
generate shorter UUID strings for interaction with users (#7089)
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/anastasis_crypto.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c index f5e6c77..8f218f7 100644 --- a/src/util/anastasis_crypto.c +++ b/src/util/anastasis_crypto.c @@ -579,4 +579,29 @@ ANASTASIS_CRYPTO_destroy_encrypted_core_secret ( } +/** + * Convert a @a uuid to a shortened, human-readable string + * useful to show to users to identify the truth. + * Note that the return value is in a global variable and + * only valid until the next invocation of this function. + * + * @param uuid UUID to convert + * @return string representation + */ +const char * +ANASTASIS_CRYPTO_uuid2s (const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid) +{ + static char uuids[7]; + char *tpk; + + tpk = GNUNET_STRINGS_data_to_string_alloc (uuid, + sizeof (*uuid)); + memcpy (uuids, + tpk, + sizeof (uuids) - 1); + GNUNET_free (tpk); + return uuids; +} + + /* end of anastasis_crypto.c */ |