Question: java or c++ Task two. Square and multiply - Fast Exponential You are to implement fast.cpp or fast.java in this task, to implement the fast

java or c++ Task two. Square and multiply - Fast Exponential

You are to implement fast.cpp or fast.java in this task, to implement the fast exponential using the square and multiply technique as described in the lecture. That is, you need to compute:

a^b (mod p)

Your program needs to input 3 parameters namely a, b and p. Then, you will need to do the following:

1. convert b into binary

2. convert that binary to the S and X notation

3. remove the first SX

4. compute according to the sequence

The program must output each process one by one to the screen - not directly outputting the final result only. The number of steps must match the sequence of SX as identified above.

Your implementation must be able to produce result (output) where the value of b is greater than 256 or a number that is at least 8 bit long.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!