d. Write a function Encode as follows: • // Return M^e mod PQ • int Encode (int M, int e, int PQ); e. Write a function Decode as follows: • //Return C^d mod PQ • int Decode (int C, int d, int PQ); f. Verify that RSA algorithm works, i.e., • int M; • /* M is an integer that is smaller than PQ */ • cout <<"Enter an integer that is smaller than"<< PQ; • cin <

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

d. Write a function Encode as follows:
• // Return M^e mod PQ
• int Encode (int M, int e, int PQ);

e. Write a function Decode as follows:
• //Return C^d mod PQ
• int Decode (int C, int d, int PQ);

f. Verify that RSA algorithm works, i.e.,
• int M;
• /* M is an integer that is smaller than PQ */
• cout <<"Enter an integer that is smaller than"<< PQ;
• cin <<M;

• C=Encode (M, e, PQ);
• M1=Decode (C, d, PQ);
• assert (M==M1); //Note: include assert.h header file to use this
//macro/function.

 

c++

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr