From 326f8f0768ff7e01bf94c2d71444a0478c49e159 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Thu, 21 Nov 2024 20:50:20 +0100 Subject: [PATCH] created WHY2_PADDING_NONZERO_TRIES macro when I try to generate random number, I need to prevent it from being zero, so I try this many times to be non-zero before I forcefully set it to 1 this should run few times but yk, theoretically the generated number can be the same for infinite time (or at least slow the performance :) ) --- include/crypto.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/crypto.h b/include/crypto.h index c6ef173..8619631 100644 --- a/include/crypto.h +++ b/include/crypto.h @@ -30,6 +30,8 @@ extern "C" { #define WHY2_SUM_BASE_PRIME 31 //PRIME FOR SUM BASE #define WHY2_SUM_MOD_PRIME 4294967295UL //PRIME FOR SUM MODULUS; 2^32 - 1 +#define WHY2_PADDING_NONZERO_TRIES 1024 //HOW MANY RANDOM NUMBERS TO TRY TO GENERATE WHEN PREVENTING 0s + //FUNCTIONS unsigned long long why2_sum_segment(char *input); //CALCULATE SUM++ FOR input; USED FOR PADDING SEED ssize_t why2_random(void *dest, size_t size); //WRITE CRYPTO-SECURE RANDOM NUMBER INTO dest