2022-12-04 18:54:57 +01:00
/*
This is part of WHY2
Copyright ( C ) 2022 Václav Š mejkal
This program is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < https : //www.gnu.org/licenses/>.
*/
2022-04-22 18:39:48 +02:00
# ifndef WHY2_MISC_H
# define WHY2_MISC_H
2024-01-23 18:27:24 +01:00
# ifdef __cplusplus
extern " C " {
# endif
2022-05-30 19:09:47 +02:00
# include <sys/time.h>
2022-05-06 17:48:28 +02:00
# include <why2/flags.h>
2024-01-24 15:03:54 +01:00
void why2_generate_text_key_chain ( char * key , int * text_key_chain , int text_key_chain_size , enum WHY2_TEXT_KEY_CHAIN_VERSIONS version ) ; //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
2023-02-08 19:31:46 +01:00
char * why2_generate_key ( int key_length ) ; //GENERATE ENCRYPTION KEY
2023-01-29 20:14:11 +01:00
void why2_deallocate_output ( why2_output_flags flags ) ; //DEALLOCATES flags
enum WHY2_EXIT_CODES why2_check_version ( void ) ; //THIS FUNCTION CHECKS IF LATEST WHY2_VERSION OF WHY2 IS USED
enum WHY2_EXIT_CODES why2_check_key ( char * key ) ; //CHECKS IF KEY IS VALID
enum WHY2_EXIT_CODES why2_check_text ( char * text ) ; //CHECKS IF TEXT IS VALID
unsigned long why2_count_int_length ( int number ) ; //RETURNS LENGTH OF number
2023-02-03 17:03:46 +01:00
unsigned long why2_count_unused_key_size ( char * text , char * key ) ; //COUNT unused_key_size
unsigned long why2_count_repeated_key_size ( char * text , char * key ) ; //COUNT repeated_key_size
2023-01-29 20:14:11 +01:00
unsigned long why2_compare_time_micro ( struct timeval startTime , struct timeval finishTime ) ; //COMPARE TIMES IN MICROSECONDS
2023-02-09 18:47:42 +01:00
void why2_die ( char * exit_message ) ; //PRINTS exit_message ERROR AND EXITS WITH CODE 1
2023-04-20 08:59:23 +02:00
char * why2_replace ( char * string , char * old , char * new ) ; //REPLACES old IN string WITH new
2022-04-22 18:39:48 +02:00
2024-01-23 18:27:24 +01:00
# ifdef __cplusplus
}
# endif
2022-04-22 18:39:48 +02:00
# endif