implemented seeded-rand fns in padding code
This commit is contained in:
parent
e363eccc59
commit
023e201ac7
@ -189,13 +189,13 @@ why2_output_flags why2_decrypt_text(char *text, char *key)
|
||||
}
|
||||
|
||||
//OBTAIN SEED FROM key_new
|
||||
srand(why2_sum_segment(key_new));
|
||||
why2_seed_random(why2_sum_segment(key_new));
|
||||
|
||||
//GET RANDOM SEQUENCE USED IN ENCRYPTION
|
||||
why2_list_t random_sequence = WHY2_LIST_EMPTY;
|
||||
for (unsigned long i = 0; i < why2_get_flags().padding; i++)
|
||||
{
|
||||
int rand_buffer = rand();
|
||||
int rand_buffer = why2_seeded_random();
|
||||
why2_list_push(&random_sequence, &rand_buffer, sizeof(int)); //ADD
|
||||
}
|
||||
why2_list_reverse(&random_sequence, sizeof(int)); //REVERSE
|
||||
|
@ -92,12 +92,12 @@ why2_output_flags why2_encrypt_text(char *text, char *key)
|
||||
}
|
||||
|
||||
//OBTAIN SEED FROM key_new
|
||||
srand(why2_sum_segment(key_new));
|
||||
why2_seed_random(why2_sum_segment(key_new));
|
||||
|
||||
//ADD PADDING TO split_text LIST
|
||||
for (unsigned long i = 0; i < why2_get_flags().padding; i++)
|
||||
{
|
||||
unsigned long random_position = (unsigned long) (rand() % (why2_list_get_size(&split_text))); //GET RANDOM POSITION
|
||||
unsigned long random_position = (unsigned long) (why2_seeded_random() % (why2_list_get_size(&split_text))); //GET RANDOM POSITION
|
||||
|
||||
char random_char = 0;
|
||||
for (int j = 0; j < WHY2_PADDING_NONZERO_TRIES && random_char == 0 ; j++) //GET RANDOM (EXCLUDING 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user