aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-28 22:28:01 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-28 22:28:01 +0100
commita2169368bbd92b77636e39b5cfe864a1236b083b (patch)
tree65da98ffc353e87a75e7e65877f3a04c897b18b4 /src/include
parent2741db1300fddb17e39373fb9d649b7022ed81d3 (diff)
downloadgnunet-a2169368bbd92b77636e39b5cfe864a1236b083b.tar.gz
gnunet-a2169368bbd92b77636e39b5cfe864a1236b083b.zip
implement #6716
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_common.h7
-rw-r--r--src/include/gnunet_crypto_lib.h16
2 files changed, 22 insertions, 1 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 707108289..4dab71f7f 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -256,7 +256,12 @@ struct GNUNET_ShortHashCode
256 256
257 257
258/** 258/**
259 * A UUID, a 128 bit random value. 259 * A UUID, a 128 bit "random" value. We OFTEN use
260 * timeflakes (see: https://github.com/anthonynsimon/timeflake),
261 * where only 80 bits are random and the rest encodes
262 * a timestamp to improve database access.
263 *
264 * See #GNUNET_CRYPTO_random_timeflake().
260 */ 265 */
261struct GNUNET_Uuid 266struct GNUNET_Uuid
262{ 267{
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 5521dad3c..d01457b4a 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -475,6 +475,22 @@ GNUNET_CRYPTO_random_block (enum GNUNET_CRYPTO_Quality mode,
475 void *buffer, 475 void *buffer,
476 size_t length); 476 size_t length);
477 477
478
479/**
480 * @ingroup crypto
481 * Fill UUID with a timeflake pseudo-random value. Note that
482 * timeflakes use only 80 bits of randomness and 48 bits
483 * to encode a timestamp in milliseconds. So what we return
484 * here is not a completely random number.
485 *
486 * @param mode desired quality of the random number
487 * @param uuid the value to fill
488 */
489void
490GNUNET_CRYPTO_random_timeflake (enum GNUNET_CRYPTO_Quality mode,
491 struct GNUNET_Uuid *uuid);
492
493
478/** 494/**
479 * @ingroup crypto 495 * @ingroup crypto
480 * Produce a random value. 496 * Produce a random value.