renamed why2_checksum_segment to why2_sum_segment

it isn't that safe to be considered a checksum and the name checksum can be misleading. i am going to use it for getting padding size
This commit is contained in:
Václav Šmejkal 2024-11-20 16:19:59 +01:00
parent c71b5275b5
commit c0e9381642
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ extern "C" {
#define WHY2_CHECKSUM_PRIME 11 //PRIME NUMBER FOR ROTATION
//FUNCTIONS
unsigned long why2_checksum_segment(char *input); //TOO LONG TO EXPLAIN, DEAL WITH IT. TREAT IT LIKE A NORMAL CHECKSUM
unsigned long why2_sum_segment(char *input); //TOO LONG TO EXPLAIN, DEAL WITH IT. TREAT IT LIKE A NORMAL CHECKSUM
#ifdef __cplusplus
}

View File

@ -21,7 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <string.h>
#include <math.h>
unsigned long why2_checksum_segment(char *input) //I ABSOLUTELY DO NOT RECOMMEND USING THIS WITH LARGE KEYS!!!
unsigned long why2_sum_segment(char *input) //I ABSOLUTELY DO NOT RECOMMEND USING THIS WITH LARGE KEYS!!!
{
unsigned long input_size = strlen(input);
unsigned long segmented_input_size = ceil(input_size / (double) WHY2_CHECKSUM_SEGMENT_SIZE) * WHY2_CHECKSUM_SEGMENT_SIZE; //CALCULATE CLOSEST 4*n TO input