The C++ version looks like the following, where
message_out is a char pointer to which a proper NULL-terminated character array should be applied as anoutput. The output is either encrypted or decrypted based off of the input
message_in char array and the variable
message_out_size is provided as an additional input in order to inform the function of the memory limitations pointed to by
message_out to prevent writing into illegal memory.
void dhke(int t,int p,int m,int b,char* message_in, char* message_out, bool encrypt, int message_out_size)
In Python, the
int type can get arbitrarily large. No such luck with C++ integers. While doing this problem, you may run into hard-to-debug issues with integer overflow. You may find this Stackoverflow question helpful, in particular the second answer.
For the C++ version the function prototype of
void keyword_generate(int key, char* keyword); //provide key and null-terminated Char array containing the keyword.
math.h library has been included for your convenience.
\ / /\__/\ \__=( o_O )= (__________) |_ |_ |_ |_Course Site powered by CAT-SOOP 14.0.4.dev5.