Key Exchange 2

Spring 2019

The questions below are due on Sunday April 07, 2019; 11:59:00 PM.
 
You are not logged in.

If you are a current student, please Log In for full access to the web site.
Note that this link will take you to an external site (https://oidc.mit.edu) to authenticate, and then you will be redirected back to this page.

Back to Exercise 08

1) C++ Implementation

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 encrypt. 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 keyword_generate is:

void keyword_generate(int key, char* keyword); //provide key and null-terminated Char array containing the keyword.

The math.h library has been included for your convenience.

void dhke(int t,int p,int m,int b,char* message_in, char* message_out, bool encrypt,int out_buffer_size){ //your code here }

Back to Exercise 08



This page was last updated on Wednesday April 03, 2019 at 09:03:55 AM (revision c358fe1).
 
Course Site powered by CAT-SOOP 14.0.4.dev5.
CAT-SOOP is free/libre software, available under the terms
of the GNU Affero General Public License, version 3.
(Download Source Code)
CSS/stryling from the Outboxcraft library Beauter, licensed under MIT
Copyright 2017