commit 25da33b51ff2fb1ba029d4baab233c83c7ea930c
parent 3ea91942f5dd739ccccee2ff2d996081003d654a
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Mon, 4 Jun 2018 10:54:02 +0200
Try flipping index until a good one is found.
Diffstat:
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c
@@ -957,17 +957,22 @@ flip_object (struct MHD_Connection *con,
#warning When free this?
current_value_flip = GNUNET_strdup (current_value);
- crockford_index = GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK,
- CROCKFORD_MAX_INDEX + 1);
flip_index = GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK,
strlen (current_value_flip));
+ do{
+ crockford_index = GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_STRONG,
+ CROCKFORD_MAX_INDEX + 1);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Try flipping with Crockford index: %u\n",
+ crockford_index);
+ }
+ while (current_value_flip[flip_index] ==
+ crockford_chars[crockford_index]);
- /* flip the LSB. WARNING: if the flipping does NOT
- * reach a Crockford-friendly char, then the test cases
- * will get disoriented by "400 Bad request" responses. */
current_value_flip[flip_index] =
crockford_chars[crockford_index];