From f754e43e19e42c604ca4563947bbd9033d9941b0 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 20 Nov 2024 17:10:39 +0100 Subject: [PATCH] made sum_segment comments more explanatory --- include/crypto.h | 2 +- src/core/lib/utils/crypto.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/crypto.h b/include/crypto.h index ed55460..8ddedbb 100644 --- a/include/crypto.h +++ b/include/crypto.h @@ -26,7 +26,7 @@ extern "C" { //MACROS #define WHY2_SUM_SEGMENT_SIZE 32 //SEGMENT SIZE FOR CALCULATING SUM #define WHY2_SUM_BASE_PRIME 31 //PRIME FOR SUM BASE -#define WHY2_SUM_MOD_PRIME 4294967295UL //PRIME FOR SUM MODULUS +#define WHY2_SUM_MOD_PRIME 4294967295UL //PRIME FOR SUM MODULUS; 2^32 - 1 //FUNCTIONS unsigned long long why2_sum_segment(char *input); //CALCULATE SUM++ FOR input; USED FOR PADDING SEED diff --git a/src/core/lib/utils/crypto.c b/src/core/lib/utils/crypto.c index 48718c0..670f603 100644 --- a/src/core/lib/utils/crypto.c +++ b/src/core/lib/utils/crypto.c @@ -21,7 +21,7 @@ along with this program. If not, see . #include #include -unsigned long long why2_sum_segment(char *input) //I ABSOLUTELY DO NOT RECOMMEND USING THIS WITH LARGE KEYS!!! +unsigned long long why2_sum_segment(char *input) //THE OUTPUT IS GOING TO GROW A LOT WITH LONG input, BUT IT SHOULDN'T BE A BIG PROBLEM. I TESTED FOR OVERFLOWS UP TO 4096-CHAR input AND ONLY GOT TO (14*10^(-7))% OF FULL ULL RANGE LMAO { unsigned long input_size = strlen(input); unsigned long segmented_input_size = ceil(input_size / (double) WHY2_SUM_SEGMENT_SIZE) * WHY2_SUM_SEGMENT_SIZE; //CALCULATE CLOSEST 32*n (OR WHY2_SUM_SEGMENT_SIZE*n, IF YOU WILL) TO input