Question: [ BBS algorithm ] Implement the methods in BBS . java. class BBS { / * the numerical components of the BBS algorithm * /
BBS algorithm Implement the methods in BBSjava.
class BBS
the numerical components of the BBS algorithm
int p q n s X;
Check that the p and q values are appropriate for the BBS algorithm.
If either one is not appropriate, throw an exception with a meaningful
message. Otherwise, compute and assign the values of n s and Xthe
latter is stored in X
Must produce the EXACT output shown in the handout, such as:
Setting up BBS with p and q
n
s
BBSint p int q throws Exception
System.out.printlnSetting up BBS with p p and q q;
To be completed you MUST keep the line above
constructor
return the largest integer less than or equal to n that is
relatively prime to n
private int chooseS
To be completed
return ; Delete this line in your submission
chooseS method
use the BBS algorithm to update X and return the next random
bit with true representing a bit and false representing a
bit.
boolean getNextRandomBit
To be completed
return false; Delete this line in your submission
getNextRandomBit method
use the BBS algorithm to return the next random integer value;
to keep values small, the most significant bits must be equal
to ; the remaining bits are produced by BBS from most to least
significant ie from left to right
int getRandomInt
To be completed
return ; Delete this line in your submission
getRandomInt method
This method is used for testing.
Do NOT modify it
public static void mainString args throws Exception
if argslength
System.out.printlnUsage: java BBS
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
